From 19bbca02d2ff6ebc7f420bb0c1e8deeeb2ea3bf6 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Thu, 13 Jun 2024 12:41:18 +0200 Subject: [PATCH] Drop the mock package This was useful with gomock, but isn't needed with stretchr/testify/mock. Signed-off-by: Stephen Kitt --- go.mod | 3 +-- go.sum | 2 -- pkg/mock/gomock.go | 45 --------------------------------------------- 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 pkg/mock/gomock.go diff --git a/go.mod b/go.mod index 1295a719..348c93d9 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/prometheus/client_golang v1.19.1 github.com/rs/zerolog v1.33.0 github.com/submariner-io/shipyard v0.19.0-m0 - go.uber.org/mock v0.4.0 golang.org/x/time v0.5.0 k8s.io/api v0.30.1 k8s.io/apimachinery v0.30.1 @@ -21,7 +20,6 @@ require ( k8s.io/klog/v2 v2.120.1 k8s.io/utils v0.0.0-20230726121419-3b25d923346b sigs.k8s.io/controller-runtime v0.18.4 - sigs.k8s.io/yaml v1.4.0 ) require ( @@ -73,4 +71,5 @@ require ( sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/mcs-api v0.1.0 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index c1e3866c..6f0757f1 100644 --- a/go.sum +++ b/go.sum @@ -403,8 +403,6 @@ go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -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.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/pkg/mock/gomock.go b/pkg/mock/gomock.go deleted file mode 100644 index e04f67f0..00000000 --- a/pkg/mock/gomock.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 - -Copyright Contributors to the Submariner project. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mock - -import ( - "fmt" - - . "github.com/onsi/gomega" - "go.uber.org/mock/gomock" - "sigs.k8s.io/yaml" -) - -func FormattingMatcher(expected interface{}, matcher gomock.Matcher) gomock.Matcher { - return gomock.GotFormatterAdapter(gomock.GotFormatterFunc(FormatToYAML), - gomock.WantFormatter(gomock.StringerFunc(func() string { - return FormatToYAML(expected) - }), matcher)) -} - -func Eq(expected interface{}) gomock.Matcher { - return FormattingMatcher(expected, gomock.Eq(expected)) -} - -func FormatToYAML(o interface{}) string { - b, err := yaml.Marshal(o) - Expect(err).To(Succeed()) - - return fmt.Sprintf("%T:\n%s", o, string(b)) -}