Skip to content

Commit 7a349c1

Browse files
committed
Ensure mockgen is the same version as gomock
Right now we 'go get' the latest version of golang/mock to build mockgen binary. On the other hand, The gomock package used in test is imported from the vendor folder. These two sources of golang/mock can easily be out of sync. This is exactly why the unit test job in CI is failing. We need to ensure that both mockgen and gomock are tied to the same release. Build mockgen from the vendored copy of golang/mock. This ensures that both are referenced from the same location and thus are always tied to the same version.
1 parent cce3e86 commit 7a349c1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ unit-test:
2727
go test -v ./pkg/...
2828

2929
generate-mocks:
30-
go get github.com/golang/mock/mockgen
30+
# Build mockgen from the same version used by gomock. This ensures that
31+
# gomock and mockgen are never out of sync.
32+
go install ./vendor/github.com/golang/mock/mockgen
3133

3234
@echo making sure directory for mocks exists
3335
mkdir -p $(MOCKS_DIR)

0 commit comments

Comments
 (0)