diff --git a/Makefile b/Makefile index 233a91c..247ff9c 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ $(GORELEASER): $(LOCALBIN) .PHONY: mockgen mockgen: $(MOCKGEN) ## Download mockgen locally if necessary. $(MOCKGEN): $(LOCALBIN) - test -s $(LOCALBIN)/mockgen || GOBIN=$(LOCALBIN) go install github.com/golang/mock/mockgen + test -s $(LOCALBIN)/mockgen || GOBIN=$(LOCALBIN) go install go.uber.org/mock/mockgen .PHONY: semver semver: $(SEMVER) ## Download semver locally if necessary. $(SEMVER): $(LOCALBIN) diff --git a/go.mod b/go.mod index 5ac4fef..4291786 100644 --- a/go.mod +++ b/go.mod @@ -2,13 +2,10 @@ module github.com/bakito/kubexporter go 1.21 -toolchain go1.21.6 - require ( github.com/Masterminds/sprig v2.22.0+incompatible github.com/bakito/semver v1.1.3 github.com/ghodss/yaml v1.0.0 - github.com/golang/mock v1.6.0 github.com/golangci/golangci-lint v1.55.2 github.com/google/uuid v1.5.0 github.com/goreleaser/goreleaser v1.23.0 @@ -19,6 +16,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/vardius/worker-pool/v2 v2.1.0 github.com/vbauerster/mpb/v5 v5.4.0 + go.uber.org/mock v0.4.0 k8s.io/api v0.29.0 k8s.io/apimachinery v0.29.0 k8s.io/cli-runtime v0.29.0 diff --git a/go.sum b/go.sum index 2945f50..e574472 100644 --- a/go.sum +++ b/go.sum @@ -568,8 +568,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -1237,6 +1235,8 @@ go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= 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.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= 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.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= diff --git a/pkg/export/worker/worker_test.go b/pkg/export/worker/worker_test.go index 5ff4080..8805ebd 100644 --- a/pkg/export/worker/worker_test.go +++ b/pkg/export/worker/worker_test.go @@ -9,10 +9,10 @@ import ( mock "github.com/bakito/kubexporter/pkg/mocks/client" "github.com/bakito/kubexporter/pkg/types" "github.com/ghodss/yaml" - gm "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + gm "go.uber.org/mock/gomock" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" diff --git a/pkg/mocks/client/mock.go b/pkg/mocks/client/mock.go index 71eda6e..b0b5fce 100644 --- a/pkg/mocks/client/mock.go +++ b/pkg/mocks/client/mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: k8s.io/client-go/dynamic (interfaces: Interface) +// +// Generated by this command: +// +// mockgen -destination pkg/mocks/client/mock.go k8s.io/client-go/dynamic Interface +// // Package mock_dynamic is a generated GoMock package. package mock_dynamic @@ -7,7 +12,7 @@ package mock_dynamic import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" schema "k8s.io/apimachinery/pkg/runtime/schema" dynamic "k8s.io/client-go/dynamic" ) @@ -44,7 +49,7 @@ func (m *MockInterface) Resource(arg0 schema.GroupVersionResource) dynamic.Names } // Resource indicates an expected call of Resource. -func (mr *MockInterfaceMockRecorder) Resource(arg0 interface{}) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Resource(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Resource", reflect.TypeOf((*MockInterface)(nil).Resource), arg0) } diff --git a/pkg/mocks/mapper/mock.go b/pkg/mocks/mapper/mock.go index b9ae6fc..1b7a5b3 100644 --- a/pkg/mocks/mapper/mock.go +++ b/pkg/mocks/mapper/mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: k8s.io/apimachinery/pkg/api/meta (interfaces: RESTMapper) +// +// Generated by this command: +// +// mockgen -destination pkg/mocks/mapper/mock.go k8s.io/apimachinery/pkg/api/meta RESTMapper +// // Package mock_meta is a generated GoMock package. package mock_meta @@ -7,7 +12,7 @@ package mock_meta import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" meta "k8s.io/apimachinery/pkg/api/meta" schema "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -45,7 +50,7 @@ func (m *MockRESTMapper) KindFor(arg0 schema.GroupVersionResource) (schema.Group } // KindFor indicates an expected call of KindFor. -func (mr *MockRESTMapperMockRecorder) KindFor(arg0 interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) KindFor(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KindFor", reflect.TypeOf((*MockRESTMapper)(nil).KindFor), arg0) } @@ -60,7 +65,7 @@ func (m *MockRESTMapper) KindsFor(arg0 schema.GroupVersionResource) ([]schema.Gr } // KindsFor indicates an expected call of KindsFor. -func (mr *MockRESTMapperMockRecorder) KindsFor(arg0 interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) KindsFor(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KindsFor", reflect.TypeOf((*MockRESTMapper)(nil).KindsFor), arg0) } @@ -68,7 +73,7 @@ func (mr *MockRESTMapperMockRecorder) KindsFor(arg0 interface{}) *gomock.Call { // RESTMapping mocks base method. func (m *MockRESTMapper) RESTMapping(arg0 schema.GroupKind, arg1 ...string) (*meta.RESTMapping, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} + varargs := []any{arg0} for _, a := range arg1 { varargs = append(varargs, a) } @@ -79,16 +84,16 @@ func (m *MockRESTMapper) RESTMapping(arg0 schema.GroupKind, arg1 ...string) (*me } // RESTMapping indicates an expected call of RESTMapping. -func (mr *MockRESTMapperMockRecorder) RESTMapping(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) RESTMapping(arg0 any, arg1 ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RESTMapping", reflect.TypeOf((*MockRESTMapper)(nil).RESTMapping), varargs...) } // RESTMappings mocks base method. func (m *MockRESTMapper) RESTMappings(arg0 schema.GroupKind, arg1 ...string) ([]*meta.RESTMapping, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} + varargs := []any{arg0} for _, a := range arg1 { varargs = append(varargs, a) } @@ -99,9 +104,9 @@ func (m *MockRESTMapper) RESTMappings(arg0 schema.GroupKind, arg1 ...string) ([] } // RESTMappings indicates an expected call of RESTMappings. -func (mr *MockRESTMapperMockRecorder) RESTMappings(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) RESTMappings(arg0 any, arg1 ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RESTMappings", reflect.TypeOf((*MockRESTMapper)(nil).RESTMappings), varargs...) } @@ -115,7 +120,7 @@ func (m *MockRESTMapper) ResourceFor(arg0 schema.GroupVersionResource) (schema.G } // ResourceFor indicates an expected call of ResourceFor. -func (mr *MockRESTMapperMockRecorder) ResourceFor(arg0 interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) ResourceFor(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceFor", reflect.TypeOf((*MockRESTMapper)(nil).ResourceFor), arg0) } @@ -130,7 +135,7 @@ func (m *MockRESTMapper) ResourceSingularizer(arg0 string) (string, error) { } // ResourceSingularizer indicates an expected call of ResourceSingularizer. -func (mr *MockRESTMapperMockRecorder) ResourceSingularizer(arg0 interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) ResourceSingularizer(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceSingularizer", reflect.TypeOf((*MockRESTMapper)(nil).ResourceSingularizer), arg0) } @@ -145,7 +150,7 @@ func (m *MockRESTMapper) ResourcesFor(arg0 schema.GroupVersionResource) ([]schem } // ResourcesFor indicates an expected call of ResourcesFor. -func (mr *MockRESTMapperMockRecorder) ResourcesFor(arg0 interface{}) *gomock.Call { +func (mr *MockRESTMapperMockRecorder) ResourcesFor(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourcesFor", reflect.TypeOf((*MockRESTMapper)(nil).ResourcesFor), arg0) } diff --git a/tools.go b/tools.go index f002def..64977a5 100644 --- a/tools.go +++ b/tools.go @@ -5,7 +5,7 @@ package tools import ( _ "github.com/bakito/semver" - _ "github.com/golang/mock/mockgen" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" _ "github.com/goreleaser/goreleaser" + _ "go.uber.org/mock/mockgen" )