From 775022f5b1d061a0ffef3fbbda7717526cc68e3b Mon Sep 17 00:00:00 2001 From: Majd Alfhaily Date: Sat, 20 Jan 2024 00:22:02 +0100 Subject: [PATCH] Replace github.com/golang/mock/gomock with go.uber.org/mock/gomock --- go.mod | 4 ++- go.sum | 32 ++++---------------- pkg/appstore/appstore_account_info_test.go | 2 +- pkg/appstore/appstore_download_test.go | 2 +- pkg/appstore/appstore_login_test.go | 2 +- pkg/appstore/appstore_lookup_test.go | 2 +- pkg/appstore/appstore_purchase_test.go | 2 +- pkg/appstore/appstore_replicate_sinf_test.go | 2 +- pkg/appstore/appstore_revoke_test.go | 2 +- pkg/appstore/appstore_search_test.go | 2 +- pkg/http/client.go | 2 +- pkg/http/client_test.go | 2 +- pkg/http/cookiejar.go | 2 +- pkg/keychain/keychain.go | 2 +- pkg/keychain/keychain_get_test.go | 2 +- pkg/keychain/keychain_remove_test.go | 2 +- pkg/keychain/keychain_set_test.go | 2 +- pkg/keychain/keyring.go | 2 +- pkg/log/logger.go | 2 +- pkg/log/logger_test.go | 2 +- pkg/log/writer.go | 2 +- pkg/log/writer_test.go | 2 +- pkg/util/machine/machine.go | 2 +- pkg/util/machine/machine_test.go | 2 +- pkg/util/operatingsystem/operatingsystem.go | 2 +- tools.go | 7 +++++ 26 files changed, 39 insertions(+), 50 deletions(-) create mode 100644 tools.go diff --git a/go.mod b/go.mod index 18d9782d..873c9eb6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.19 require ( github.com/99designs/keyring v1.2.1 github.com/avast/retry-go v3.0.0+incompatible - github.com/golang/mock v1.7.0-rc.1 github.com/juju/persistent-cookiejar v1.0.0 github.com/onsi/ginkgo/v2 v2.5.0 github.com/onsi/gomega v1.24.0 @@ -13,6 +12,7 @@ require ( github.com/schollz/progressbar/v3 v3.13.1 github.com/spf13/cobra v1.6.1 github.com/thediveo/enumflag/v2 v2.0.1 + go.uber.org/mock v0.4.0 golang.org/x/net v0.20.0 golang.org/x/term v0.16.0 howett.net/plist v1.0.0 @@ -37,8 +37,10 @@ require ( github.com/rivo/uniseg v0.2.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.17.0 // indirect gopkg.in/errgo.v1 v1.0.1 // indirect gopkg.in/retry.v1 v1.0.3 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 42d34eba..1363047e 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,6 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/mock v1.7.0-rc.1 h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U= -github.com/golang/mock v1.7.0-rc.1/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -86,46 +84,28 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/thediveo/enumflag/v2 v2.0.1 h1:2bmWZPD2uSARDsOjXIdLRlNcYBFNF9xX0RNUNF2vKic= github.com/thediveo/enumflag/v2 v2.0.1/go.mod h1:SyxyCNvv0QeRtZ7fjuaUz4FRLC3cWuDiD7QdORU0MGg= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= diff --git a/pkg/appstore/appstore_account_info_test.go b/pkg/appstore/appstore_account_info_test.go index 06138e3f..14a0b926 100644 --- a/pkg/appstore/appstore_account_info_test.go +++ b/pkg/appstore/appstore_account_info_test.go @@ -4,10 +4,10 @@ import ( "errors" "fmt" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/keychain" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("AppStore (AccountInfo)", func() { diff --git a/pkg/appstore/appstore_download_test.go b/pkg/appstore/appstore_download_test.go index b6b6d5ad..91618264 100644 --- a/pkg/appstore/appstore_download_test.go +++ b/pkg/appstore/appstore_download_test.go @@ -9,13 +9,13 @@ import ( "os" "strings" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/http" "github.com/majd/ipatool/v2/pkg/keychain" "github.com/majd/ipatool/v2/pkg/util/machine" "github.com/majd/ipatool/v2/pkg/util/operatingsystem" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" "howett.net/plist" ) diff --git a/pkg/appstore/appstore_login_test.go b/pkg/appstore/appstore_login_test.go index bd097a30..b0310cf6 100644 --- a/pkg/appstore/appstore_login_test.go +++ b/pkg/appstore/appstore_login_test.go @@ -6,12 +6,12 @@ import ( "fmt" "strings" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/http" "github.com/majd/ipatool/v2/pkg/keychain" "github.com/majd/ipatool/v2/pkg/util/machine" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("AppStore (Login)", func() { diff --git a/pkg/appstore/appstore_lookup_test.go b/pkg/appstore/appstore_lookup_test.go index 816a76f7..be84bc7c 100644 --- a/pkg/appstore/appstore_lookup_test.go +++ b/pkg/appstore/appstore_lookup_test.go @@ -3,10 +3,10 @@ package appstore import ( "errors" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/http" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("AppStore (Lookup)", func() { diff --git a/pkg/appstore/appstore_purchase_test.go b/pkg/appstore/appstore_purchase_test.go index dcdb2396..847758f2 100644 --- a/pkg/appstore/appstore_purchase_test.go +++ b/pkg/appstore/appstore_purchase_test.go @@ -3,12 +3,12 @@ package appstore import ( "errors" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/http" "github.com/majd/ipatool/v2/pkg/keychain" "github.com/majd/ipatool/v2/pkg/util/machine" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("AppStore (Purchase)", func() { diff --git a/pkg/appstore/appstore_replicate_sinf_test.go b/pkg/appstore/appstore_replicate_sinf_test.go index ef1169ad..ac98c3fe 100644 --- a/pkg/appstore/appstore_replicate_sinf_test.go +++ b/pkg/appstore/appstore_replicate_sinf_test.go @@ -6,13 +6,13 @@ import ( "fmt" "os" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/http" "github.com/majd/ipatool/v2/pkg/keychain" "github.com/majd/ipatool/v2/pkg/util/machine" "github.com/majd/ipatool/v2/pkg/util/operatingsystem" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" "howett.net/plist" ) diff --git a/pkg/appstore/appstore_revoke_test.go b/pkg/appstore/appstore_revoke_test.go index 3e3d69a6..4c4257d7 100644 --- a/pkg/appstore/appstore_revoke_test.go +++ b/pkg/appstore/appstore_revoke_test.go @@ -3,10 +3,10 @@ package appstore import ( "errors" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/keychain" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("AppStore (Revoke)", func() { diff --git a/pkg/appstore/appstore_search_test.go b/pkg/appstore/appstore_search_test.go index c8e34b72..fdedd4c2 100644 --- a/pkg/appstore/appstore_search_test.go +++ b/pkg/appstore/appstore_search_test.go @@ -3,10 +3,10 @@ package appstore import ( "errors" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/http" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("AppStore (Search)", func() { diff --git a/pkg/http/client.go b/pkg/http/client.go index 791fb48a..93fbabc3 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -11,7 +11,7 @@ import ( "howett.net/plist" ) -//go:generate go run github.com/golang/mock/mockgen -source=client.go -destination=client_mock.go -package=http +//go:generate go run go.uber.org/mock/mockgen -source=client.go -destination=client_mock.go -package=http type Client[R interface{}] interface { Send(request Request) (Result[R], error) Do(req *http.Request) (*http.Response, error) diff --git a/pkg/http/client_test.go b/pkg/http/client_test.go index c142ec99..99d2ba9e 100644 --- a/pkg/http/client_test.go +++ b/pkg/http/client_test.go @@ -5,9 +5,9 @@ import ( "net/http" "net/http/httptest" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("Client", Ordered, func() { diff --git a/pkg/http/cookiejar.go b/pkg/http/cookiejar.go index 47c73101..0794a361 100644 --- a/pkg/http/cookiejar.go +++ b/pkg/http/cookiejar.go @@ -2,7 +2,7 @@ package http import "net/http" -//go:generate go run github.com/golang/mock/mockgen -source=cookiejar.go -destination=cookiejar_mock.go -package=http +//go:generate go run go.uber.org/mock/mockgen -source=cookiejar.go -destination=cookiejar_mock.go -package=http type CookieJar interface { http.CookieJar diff --git a/pkg/keychain/keychain.go b/pkg/keychain/keychain.go index 5cb54706..6ff34da0 100644 --- a/pkg/keychain/keychain.go +++ b/pkg/keychain/keychain.go @@ -1,6 +1,6 @@ package keychain -//go:generate go run github.com/golang/mock/mockgen -source=keychain.go -destination=keychain_mock.go -package keychain +//go:generate go run go.uber.org/mock/mockgen -source=keychain.go -destination=keychain_mock.go -package keychain type Keychain interface { Get(key string) ([]byte, error) Set(key string, data []byte) error diff --git a/pkg/keychain/keychain_get_test.go b/pkg/keychain/keychain_get_test.go index 3a567994..418b6263 100644 --- a/pkg/keychain/keychain_get_test.go +++ b/pkg/keychain/keychain_get_test.go @@ -4,9 +4,9 @@ import ( "errors" "github.com/99designs/keyring" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("Keychain (Get)", func() { diff --git a/pkg/keychain/keychain_remove_test.go b/pkg/keychain/keychain_remove_test.go index 7b0213eb..7c8cc96b 100644 --- a/pkg/keychain/keychain_remove_test.go +++ b/pkg/keychain/keychain_remove_test.go @@ -3,9 +3,9 @@ package keychain import ( "errors" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("Keychain (Remove)", func() { diff --git a/pkg/keychain/keychain_set_test.go b/pkg/keychain/keychain_set_test.go index c7ce57e7..ce16fe73 100644 --- a/pkg/keychain/keychain_set_test.go +++ b/pkg/keychain/keychain_set_test.go @@ -4,9 +4,9 @@ import ( "errors" "github.com/99designs/keyring" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) var _ = Describe("Keychain (Set)", func() { diff --git a/pkg/keychain/keyring.go b/pkg/keychain/keyring.go index b1ea653d..37d0f820 100644 --- a/pkg/keychain/keyring.go +++ b/pkg/keychain/keyring.go @@ -2,7 +2,7 @@ package keychain import "github.com/99designs/keyring" -//go:generate go run github.com/golang/mock/mockgen -source=keyring.go -destination=keyring_mock.go -package keychain +//go:generate go run go.uber.org/mock/mockgen -source=keyring.go -destination=keyring_mock.go -package keychain type Keyring interface { Get(key string) (keyring.Item, error) Set(item keyring.Item) error diff --git a/pkg/log/logger.go b/pkg/log/logger.go index ddf611d9..2833ce60 100644 --- a/pkg/log/logger.go +++ b/pkg/log/logger.go @@ -8,7 +8,7 @@ import ( "github.com/rs/zerolog/pkgerrors" ) -//go:generate go run github.com/golang/mock/mockgen -source=logger.go -destination=logger_mock.go -package log +//go:generate go run go.uber.org/mock/mockgen -source=logger.go -destination=logger_mock.go -package log type Logger interface { Verbose() *zerolog.Event Log() *zerolog.Event diff --git a/pkg/log/logger_test.go b/pkg/log/logger_test.go index 2d4e8fa7..51a5b275 100644 --- a/pkg/log/logger_test.go +++ b/pkg/log/logger_test.go @@ -4,8 +4,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/golang/mock/gomock" "github.com/rs/zerolog" + "go.uber.org/mock/gomock" ) var _ = Describe("Logger", func() { diff --git a/pkg/log/writer.go b/pkg/log/writer.go index 0749057d..4b3ecb98 100644 --- a/pkg/log/writer.go +++ b/pkg/log/writer.go @@ -8,7 +8,7 @@ import ( "github.com/rs/zerolog" ) -//go:generate go run github.com/golang/mock/mockgen -source=writer.go -destination=writer_mock.go -package log +//go:generate go run go.uber.org/mock/mockgen -source=writer.go -destination=writer_mock.go -package log type Writer interface { Write(p []byte) (n int, err error) WriteLevel(level zerolog.Level, p []byte) (n int, err error) diff --git a/pkg/log/writer_test.go b/pkg/log/writer_test.go index f0739458..c2acc38b 100644 --- a/pkg/log/writer_test.go +++ b/pkg/log/writer_test.go @@ -1,10 +1,10 @@ package log import ( - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/rs/zerolog" + "go.uber.org/mock/gomock" ) var _ = Describe("Writer", func() { diff --git a/pkg/util/machine/machine.go b/pkg/util/machine/machine.go index 46cd91b5..d2376e26 100644 --- a/pkg/util/machine/machine.go +++ b/pkg/util/machine/machine.go @@ -10,7 +10,7 @@ import ( "golang.org/x/term" ) -//go:generate go run github.com/golang/mock/mockgen -source=machine.go -destination=machine_mock.go -package machine +//go:generate go run go.uber.org/mock/mockgen -source=machine.go -destination=machine_mock.go -package machine type Machine interface { MacAddress() (string, error) HomeDirectory() string diff --git a/pkg/util/machine/machine_test.go b/pkg/util/machine/machine_test.go index 619f0a22..43e6e2ff 100644 --- a/pkg/util/machine/machine_test.go +++ b/pkg/util/machine/machine_test.go @@ -4,10 +4,10 @@ import ( "syscall" "testing" - "github.com/golang/mock/gomock" "github.com/majd/ipatool/v2/pkg/util/operatingsystem" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" ) func TestMachine(t *testing.T) { diff --git a/pkg/util/operatingsystem/operatingsystem.go b/pkg/util/operatingsystem/operatingsystem.go index 851a4c0e..fef97adc 100644 --- a/pkg/util/operatingsystem/operatingsystem.go +++ b/pkg/util/operatingsystem/operatingsystem.go @@ -4,7 +4,7 @@ import ( "os" ) -//go:generate go run github.com/golang/mock/mockgen -source=operatingsystem.go -destination=operatingsystem_mock.go -package operatingsystem +//go:generate go run go.uber.org/mock/mockgen -source=operatingsystem.go -destination=operatingsystem_mock.go -package operatingsystem type OperatingSystem interface { Getenv(key string) string Stat(name string) (os.FileInfo, error) diff --git a/tools.go b/tools.go new file mode 100644 index 00000000..b93ca87e --- /dev/null +++ b/tools.go @@ -0,0 +1,7 @@ +//go:build tools + +package main + +import ( + _ "go.uber.org/mock/mockgen" +)