From e339541946da47e0b2c51f55b6ed29a4012ced61 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Wed, 25 Sep 2024 12:09:40 +0100 Subject: [PATCH] chore_: mock_peer package name, clean command --- Makefile | 7 +++++++ rpc/chain/client.go | 2 +- services/peer/api_test.go | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 45d3926ec..f9bb7c284 100644 --- a/Makefile +++ b/Makefile @@ -316,6 +316,13 @@ generate: @packages=$$(go list ./... | grep -v "./contracts"); \ go generate $$packages +clean-generated: SHELL := /bin/sh +clean-generated: + # Remove anything generated, excluding ./vendor and ./contracts directories + find . -type d -name "mock" ! -path "./vendor/*" ! -path "./contracts/*" -exec rm -rf {} + + # In theory this is only ./transactions/fake/mock.go + find . -type f -name "mock.go" ! -path "./vendor/*" -exec echo {} + + download-uniswap-tokens: go run ./services/wallet/token/downloader/main.go diff --git a/rpc/chain/client.go b/rpc/chain/client.go index 668e8aade..24741d161 100644 --- a/rpc/chain/client.go +++ b/rpc/chain/client.go @@ -1,6 +1,6 @@ package chain -//go:generate mockgen -package=mock_client -package=mock_client -source=client.go -destination=mock/client/client.go +//go:generate mockgen -package=mock_client -source=client.go -destination=mock/client/client.go import ( "context" diff --git a/services/peer/api_test.go b/services/peer/api_test.go index 4f690f3ed..2d847d19e 100644 --- a/services/peer/api_test.go +++ b/services/peer/api_test.go @@ -7,6 +7,8 @@ import ( "github.com/stretchr/testify/suite" "go.uber.org/mock/gomock" + + "github.com/status-im/status-go/services/peer/mock" ) func TestPeerSuite(t *testing.T) { @@ -17,12 +19,12 @@ type PeerSuite struct { suite.Suite api *PublicAPI s *Service - d *MockDiscoverer + d *mock_peer.MockDiscoverer } func (s *PeerSuite) SetupTest() { ctrl := gomock.NewController(s.T()) - s.d = NewMockDiscoverer(ctrl) + s.d = mock_peer.NewMockDiscoverer(ctrl) s.s = New() s.api = NewAPI(s.s) }