Skip to content

Commit 6816161

Browse files
authored
Merge pull request #801 from elprogramadorgt/refactor/mock-library
refactor(mock): switch mocking library from golang/mock to go.uber.org/mock
2 parents 8a0a836 + ed705ba commit 6816161

27 files changed

+35
-32
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ doc-predicate: ## Generate markdown documentation for all the predicates (module
362362
.PHONY: mock
363363
mock: ## Generate all the mocks (for tests)
364364
@echo "${COLOR_CYAN} 🧱 Generating all the mocks${COLOR_RESET}"
365-
@go install github.com/golang/mock/mockgen@v1.6.0
365+
@go install go.uber.org/mock/mockgen@v0.5.0
366366
@mockgen -source=x/mint/types/expected_keepers.go -package testutil -destination x/mint/testutil/expected_keepers_mocks.go
367367
@mockgen -source=x/vesting/types/expected_keepers.go -package testutil -destination x/vesting/testutil/expected_keepers_mocks.go
368368
@mockgen -source=x/logic/types/expected_keepers.go -package testutil -destination x/logic/testutil/expected_keepers_mocks.go

go.mod

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ require (
3434
github.com/cucumber/godog v0.15.0
3535
github.com/cucumber/messages/go/v21 v21.0.1
3636
github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564
37-
github.com/golang/mock v1.6.0
3837
github.com/golang/protobuf v1.5.4
3938
github.com/grpc-ecosystem/grpc-gateway v1.16.0
4039
github.com/hashicorp/go-metrics v0.5.3
@@ -56,6 +55,7 @@ require (
5655
github.com/spf13/viper v1.19.0
5756
github.com/stretchr/testify v1.9.0
5857
github.com/wk8/go-ordered-map/v2 v2.1.8
58+
go.uber.org/mock v0.5.0
5959
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0
6060
golang.org/x/net v0.30.0
6161
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142
@@ -161,6 +161,7 @@ require (
161161
github.com/gogo/protobuf v1.3.2 // indirect
162162
github.com/golang/glog v1.2.2 // indirect
163163
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
164+
github.com/golang/mock v1.6.0 // indirect
164165
github.com/golang/snappy v0.0.4 // indirect
165166
github.com/google/btree v1.1.3 // indirect
166167
github.com/google/flatbuffers v1.12.1 // indirect
@@ -289,14 +290,14 @@ require (
289290
go.opentelemetry.io/otel/trace v1.24.0 // indirect
290291
go.uber.org/multierr v1.11.0 // indirect
291292
golang.org/x/crypto v0.28.0 // indirect
292-
golang.org/x/mod v0.17.0 // indirect
293+
golang.org/x/mod v0.18.0 // indirect
293294
golang.org/x/oauth2 v0.22.0 // indirect
294295
golang.org/x/sync v0.8.0 // indirect
295296
golang.org/x/sys v0.26.0 // indirect
296297
golang.org/x/term v0.25.0 // indirect
297298
golang.org/x/text v0.19.0 // indirect
298299
golang.org/x/time v0.5.0 // indirect
299-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
300+
golang.org/x/tools v0.22.0 // indirect
300301
google.golang.org/api v0.171.0 // indirect
301302
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
302303
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
13131313
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
13141314
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
13151315
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
1316+
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
1317+
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
13161318
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
13171319
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
13181320
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
@@ -1386,8 +1388,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
13861388
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
13871389
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
13881390
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
1389-
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
1390-
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1391+
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
1392+
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
13911393
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
13921394
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
13931395
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1701,8 +1703,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
17011703
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
17021704
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
17031705
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
1704-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
1705-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
1706+
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
1707+
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
17061708
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
17071709
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
17081710
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

x/logic/fs/composite/fs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/golang/mock/gomock"
11+
"go.uber.org/mock/gomock"
1212

1313
. "github.com/smartystreets/goconvey/convey"
1414

x/logic/fs/filtered/fs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"testing"
77
"time"
88

9-
"github.com/golang/mock/gomock"
109
"github.com/samber/lo"
10+
"go.uber.org/mock/gomock"
1111

1212
. "github.com/smartystreets/goconvey/convey"
1313

x/logic/fs/wasm/fs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"testing"
1010

1111
dbm "github.com/cosmos/cosmos-db"
12-
"github.com/golang/mock/gomock"
12+
"go.uber.org/mock/gomock"
1313

1414
. "github.com/smartystreets/goconvey/convey"
1515

x/logic/keeper/features_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414

1515
"dario.cat/mergo"
1616
"github.com/cucumber/godog"
17-
"github.com/golang/mock/gomock"
1817
"github.com/sergi/go-diff/diffmatchpatch"
1918
"github.com/smartystreets/goconvey/convey/reporting"
19+
"go.uber.org/mock/gomock"
2020
"gopkg.in/yaml.v3"
2121

2222
. "github.com/smartystreets/goconvey/convey"

x/logic/keeper/grpc_query_ask_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"io/fs"
77
"testing"
88

9-
"github.com/golang/mock/gomock"
9+
"go.uber.org/mock/gomock"
1010

1111
. "github.com/smartystreets/goconvey/convey"
1212

x/logic/keeper/grpc_query_params_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"io/fs"
77
"testing"
88

9-
"github.com/golang/mock/gomock"
9+
"go.uber.org/mock/gomock"
1010

1111
. "github.com/smartystreets/goconvey/convey"
1212

x/logic/keeper/migrations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"io/fs"
77
"testing"
88

9-
"github.com/golang/mock/gomock"
109
"github.com/samber/lo"
10+
"go.uber.org/mock/gomock"
1111

1212
. "github.com/smartystreets/goconvey/convey"
1313

x/logic/keeper/msg_server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"io/fs"
77
"testing"
88

9-
"github.com/golang/mock/gomock"
9+
"go.uber.org/mock/gomock"
1010

1111
. "github.com/smartystreets/goconvey/convey"
1212

x/logic/meter/weighted_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"math"
66
"testing"
77

8-
"github.com/golang/mock/gomock"
8+
"go.uber.org/mock/gomock"
99

1010
. "github.com/smartystreets/goconvey/convey"
1111

x/logic/predicate/bank_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99

1010
"github.com/axone-protocol/prolog/engine"
1111
dbm "github.com/cosmos/cosmos-db"
12-
"github.com/golang/mock/gomock"
1312
"github.com/samber/lo"
13+
"go.uber.org/mock/gomock"
1414
"google.golang.org/grpc/codes"
1515
"google.golang.org/grpc/status"
1616

x/logic/predicate/builtin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/axone-protocol/prolog/engine"
88
dbm "github.com/cosmos/cosmos-db"
9-
"github.com/golang/mock/gomock"
9+
"go.uber.org/mock/gomock"
1010

1111
. "github.com/smartystreets/goconvey/convey"
1212

x/logic/predicate/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
dbm "github.com/cosmos/cosmos-db"
9-
"github.com/golang/mock/gomock"
9+
"go.uber.org/mock/gomock"
1010

1111
. "github.com/smartystreets/goconvey/convey"
1212

x/logic/testutil/expected_keepers_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/logic/testutil/fs_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/logic/testutil/gas_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/logic/testutil/interface_registry_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/logic/testutil/keeper_mocks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"strconv"
77

8-
"github.com/golang/mock/gomock"
98
"github.com/samber/lo"
9+
"go.uber.org/mock/gomock"
1010

1111
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
1212
sdk "github.com/cosmos/cosmos-sdk/types"

x/logic/testutil/read_file_fs_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/mint/keeper/genesis_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package keeper_test
33
import (
44
"testing"
55

6-
"github.com/golang/mock/gomock"
76
"github.com/stretchr/testify/suite"
7+
"go.uber.org/mock/gomock"
88

99
"cosmossdk.io/collections"
1010
"cosmossdk.io/math"

x/mint/keeper/grpc_query_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
gocontext "context"
55
"testing"
66

7-
"github.com/golang/mock/gomock"
87
"github.com/stretchr/testify/suite"
8+
"go.uber.org/mock/gomock"
99

1010
storetypes "cosmossdk.io/store/types"
1111

x/mint/keeper/keeper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package keeper_test
33
import (
44
"testing"
55

6-
"github.com/golang/mock/gomock"
76
"github.com/stretchr/testify/suite"
7+
"go.uber.org/mock/gomock"
88

99
"cosmossdk.io/math"
1010
storetypes "cosmossdk.io/store/types"

x/mint/testutil/expected_keepers_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/vesting/msg_server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"testing"
55
"time"
66

7-
"github.com/golang/mock/gomock"
87
"github.com/stretchr/testify/suite"
8+
"go.uber.org/mock/gomock"
99

1010
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
1111
cmttime "github.com/cometbft/cometbft/types/time"

x/vesting/testutil/expected_keepers_mocks.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)