switch from unmaintained golang/mock to go.uber.org/mock (#4050)

This commit is contained in:
Marten Seemann
2023-08-28 16:23:55 +07:00
committed by GitHub
parent 8f34488c76
commit 2797f85fc0
87 changed files with 130 additions and 167 deletions

View File

@@ -8,9 +8,9 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
wire "github.com/quic-go/quic-go/internal/wire"
gomock "go.uber.org/mock/gomock"
)
// MockReceivedPacketHandler is a mock of ReceivedPacketHandler interface.

View File

@@ -8,10 +8,10 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
ackhandler "github.com/quic-go/quic-go/internal/ackhandler"
protocol "github.com/quic-go/quic-go/internal/protocol"
wire "github.com/quic-go/quic-go/internal/wire"
gomock "go.uber.org/mock/gomock"
)
// MockSentPacketHandler is a mock of SentPacketHandler interface.

View File

@@ -8,8 +8,8 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockSendAlgorithmWithDebugInfos is a mock of SendAlgorithmWithDebugInfos interface.

View File

@@ -7,8 +7,8 @@ package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockConnectionFlowController is a mock of ConnectionFlowController interface.

View File

@@ -7,9 +7,9 @@ package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
handshake "github.com/quic-go/quic-go/internal/handshake"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockCryptoSetup is a mock of CryptoSetup interface.

View File

@@ -9,11 +9,11 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
utils "github.com/quic-go/quic-go/internal/utils"
wire "github.com/quic-go/quic-go/internal/wire"
logging "github.com/quic-go/quic-go/logging"
gomock "go.uber.org/mock/gomock"
)
// MockConnectionTracer is a mock of ConnectionTracer interface.

View File

@@ -8,10 +8,10 @@ import (
net "net"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
wire "github.com/quic-go/quic-go/internal/wire"
logging "github.com/quic-go/quic-go/logging"
gomock "go.uber.org/mock/gomock"
)
// MockTracer is a mock of Tracer interface.

View File

@@ -7,8 +7,8 @@ package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockLongHeaderOpener is a mock of LongHeaderOpener interface.

View File

@@ -1,19 +1,19 @@
package mocks
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mockquic -destination quic/stream.go github.com/quic-go/quic-go Stream"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mockquic -destination quic/early_conn_tmp.go github.com/quic-go/quic-go EarlyConnection && sed 's/qtls.ConnectionState/quic.ConnectionState/g' quic/early_conn_tmp.go > quic/early_conn.go && rm quic/early_conn_tmp.go && go run golang.org/x/tools/cmd/goimports -w quic/early_conn.go"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocklogging -destination logging/tracer.go github.com/quic-go/quic-go/logging Tracer"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocklogging -destination logging/connection_tracer.go github.com/quic-go/quic-go/logging ConnectionTracer"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination short_header_sealer.go github.com/quic-go/quic-go/internal/handshake ShortHeaderSealer"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination short_header_opener.go github.com/quic-go/quic-go/internal/handshake ShortHeaderOpener"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination long_header_opener.go github.com/quic-go/quic-go/internal/handshake LongHeaderOpener"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination crypto_setup_tmp.go github.com/quic-go/quic-go/internal/handshake CryptoSetup && sed -E 's~github.com/quic-go/qtls[[:alnum:]_-]*~github.com/quic-go/quic-go/internal/qtls~g; s~qtls.ConnectionStateWith0RTT~qtls.ConnectionState~g' crypto_setup_tmp.go > crypto_setup.go && rm crypto_setup_tmp.go && go run golang.org/x/tools/cmd/goimports -w crypto_setup.go"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination stream_flow_controller.go github.com/quic-go/quic-go/internal/flowcontrol StreamFlowController"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination congestion.go github.com/quic-go/quic-go/internal/congestion SendAlgorithmWithDebugInfos"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mocks -destination connection_flow_controller.go github.com/quic-go/quic-go/internal/flowcontrol ConnectionFlowController"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mockackhandler -destination ackhandler/sent_packet_handler.go github.com/quic-go/quic-go/internal/ackhandler SentPacketHandler"
//go:generate sh -c "go run github.com/golang/mock/mockgen -package mockackhandler -destination ackhandler/received_packet_handler.go github.com/quic-go/quic-go/internal/ackhandler ReceivedPacketHandler"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mockquic -destination quic/stream.go github.com/quic-go/quic-go Stream"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mockquic -destination quic/early_conn_tmp.go github.com/quic-go/quic-go EarlyConnection && sed 's/qtls.ConnectionState/quic.ConnectionState/g' quic/early_conn_tmp.go > quic/early_conn.go && rm quic/early_conn_tmp.go && go run golang.org/x/tools/cmd/goimports -w quic/early_conn.go"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocklogging -destination logging/tracer.go github.com/quic-go/quic-go/logging Tracer"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocklogging -destination logging/connection_tracer.go github.com/quic-go/quic-go/logging ConnectionTracer"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination short_header_sealer.go github.com/quic-go/quic-go/internal/handshake ShortHeaderSealer"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination short_header_opener.go github.com/quic-go/quic-go/internal/handshake ShortHeaderOpener"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination long_header_opener.go github.com/quic-go/quic-go/internal/handshake LongHeaderOpener"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination crypto_setup_tmp.go github.com/quic-go/quic-go/internal/handshake CryptoSetup && sed -E 's~github.com/quic-go/qtls[[:alnum:]_-]*~github.com/quic-go/quic-go/internal/qtls~g; s~qtls.ConnectionStateWith0RTT~qtls.ConnectionState~g' crypto_setup_tmp.go > crypto_setup.go && rm crypto_setup_tmp.go && go run golang.org/x/tools/cmd/goimports -w crypto_setup.go"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination stream_flow_controller.go github.com/quic-go/quic-go/internal/flowcontrol StreamFlowController"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination congestion.go github.com/quic-go/quic-go/internal/congestion SendAlgorithmWithDebugInfos"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocks -destination connection_flow_controller.go github.com/quic-go/quic-go/internal/flowcontrol ConnectionFlowController"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mockackhandler -destination ackhandler/sent_packet_handler.go github.com/quic-go/quic-go/internal/ackhandler SentPacketHandler"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mockackhandler -destination ackhandler/received_packet_handler.go github.com/quic-go/quic-go/internal/ackhandler ReceivedPacketHandler"
// 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 "go run github.com/golang/mock/mockgen -package mocktls -destination tls/client_session_cache.go crypto/tls ClientSessionCache"
//go:generate sh -c "go run go.uber.org/mock/mockgen -package mocktls -destination tls/client_session_cache.go crypto/tls ClientSessionCache"

View File

@@ -9,9 +9,9 @@ import (
net "net"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
quic "github.com/quic-go/quic-go"
qerr "github.com/quic-go/quic-go/internal/qerr"
gomock "go.uber.org/mock/gomock"
)
// MockEarlyConnection is a mock of EarlyConnection interface.

View File

@@ -9,9 +9,9 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
qerr "github.com/quic-go/quic-go/internal/qerr"
gomock "go.uber.org/mock/gomock"
)
// MockStream is a mock of Stream interface.

View File

@@ -8,8 +8,8 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockShortHeaderOpener is a mock of ShortHeaderOpener interface.

View File

@@ -7,8 +7,8 @@ package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockShortHeaderSealer is a mock of ShortHeaderSealer interface.

View File

@@ -7,8 +7,8 @@ package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
protocol "github.com/quic-go/quic-go/internal/protocol"
gomock "go.uber.org/mock/gomock"
)
// MockStreamFlowController is a mock of StreamFlowController interface.

View File

@@ -8,7 +8,7 @@ import (
tls "crypto/tls"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
gomock "go.uber.org/mock/gomock"
)
// MockClientSessionCache is a mock of ClientSessionCache interface.