simplify generation of mocks for internal types

This commit is contained in:
Marten Seemann
2020-01-26 13:24:35 +07:00
parent c809166cab
commit 4fa5cfdca9
4 changed files with 16 additions and 49 deletions

View File

@@ -6,8 +6,9 @@ package handshake
import (
tls "crypto/tls"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockClientSessionCache is a mock of ClientSessionCache interface

View File

@@ -1,4 +1,7 @@
package handshake
//go:generate sh -c "../mockgen_internal.sh handshake mock_handshake_runner_test.go github.com/lucas-clemente/quic-go/internal/handshake handshakeRunner"
//go:generate sh -c "mockgen -package handshake crypto/tls ClientSessionCache > mock_client_session_cache_test.go"
//go:generate sh -c "../../mockgen_private.sh handshake mock_handshake_runner_test.go github.com/lucas-clemente/quic-go/internal/handshake handshakeRunner"
// The following command produces a warning message on OSX, however, it still generates the correct mock file.
// See https://github.com/golang/mock/issues/339 for details.
//go:generate sh -c "mockgen -package handshake -destination mock_client_session_cache_test.go crypto/tls ClientSessionCache && goimports -w mock_client_session_cache_test.go"