From c68e15f9a9c2a5c6e5a0f7549da8ed9f25e34590 Mon Sep 17 00:00:00 2001 From: Walter Date: Sun, 6 Jul 2025 23:25:12 -0700 Subject: [PATCH] Upgrade mockgen version to 0.5.2 Added a check to ensure we are using the correct mockgen version. Used 'go get' to upgrade the mockgen version. Used 'go mod tidy' to clean up. Regenerated the mocks but got no changes. --- Makefile | 6 ++++++ README.md | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- vendor/modules.txt | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ca045d435..7bf1d6c63 100644 --- a/Makefile +++ b/Makefile @@ -57,11 +57,17 @@ PROXY_SERVER_IP ?= 127.0.0.1 KIND_IMAGE ?= kindest/node:v1.30.2 CONNECTION_MODE ?= grpc + +MOCKGEN_VERSION := $(shell mockgen -version) +DESIRED_MOCKGEN := "v0.5.2" + ## -------------------------------------- ## Testing ## -------------------------------------- .PHONY: mock_gen mock_gen: + echo "Mock gen is set to $(MOCKGEN_VERSION)" + if [ "$(MOCKGEN_VERSION)" != $(DESIRED_MOCKGEN) ]; then echo "Error need mockgen version $(DESIRED_VERSION)"; exit 1; fi mkdir -p proto/agent/mocks mockgen --build_flags=--mod=mod sigs.k8s.io/apiserver-network-proxy/proto/agent AgentService_ConnectServer > proto/agent/mocks/agent_mock.go cat hack/go-license-header.txt proto/agent/mocks/agent_mock.go > proto/agent/mocks/agent_mock.licensed.go diff --git a/README.md b/README.md index f7680dd79..488ad82f2 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ Please ensure the go bin directory (usually `~/go/bin`) is in your `PATH`. The [```mockgen```](https://github.com/uber-go/mock) tool must be installed on your system. -Currently, we are using go.uber.org/mock/mockgen@v0.5.0 +Currently, we are using go.uber.org/mock/mockgen@v0.5.2 -`go install go.uber.org/mock/mockgen@v0.5.0` +`go install go.uber.org/mock/mockgen@v0.5.2` ### Protoc diff --git a/go.mod b/go.mod index 4d6948c35..5ed540d6c 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/spf13/pflag v1.0.6 github.com/stretchr/testify v1.10.0 go.uber.org/goleak v1.3.0 - go.uber.org/mock v0.5.0 + go.uber.org/mock v0.5.2 golang.org/x/net v0.37.0 google.golang.org/grpc v1.71.0 google.golang.org/protobuf v1.36.6 diff --git a/go.sum b/go.sum index 5ea85cd67..3f3a826b5 100644 --- a/go.sum +++ b/go.sum @@ -137,8 +137,8 @@ go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= -go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= +go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= +go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= diff --git a/vendor/modules.txt b/vendor/modules.txt index 1a1e4db46..00a133c7a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -177,7 +177,7 @@ go.opentelemetry.io/otel/trace/embedded ## explicit; go 1.20 go.uber.org/goleak go.uber.org/goleak/internal/stack -# go.uber.org/mock v0.5.0 +# go.uber.org/mock v0.5.2 ## explicit; go 1.22 go.uber.org/mock/gomock # golang.org/x/net v0.37.0