Skip to content

Commit 697732d

Browse files
authored
make: fix gen issue with mockgen not found in PATH (#10162) (#10166)
Fixes #10157 (comment) Problem was: ``` grep -r -l --exclude-dir=erigon-lib "^// Code generated by MockGen. DO NOT EDIT.$" . | xargs rm -r ``` was deleting the `mockgen` binary after it was built 🙃
1 parent 82262fe commit 697732d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
GO ?= go # if using docker, should not need to be installed/linked
2-
GOBIN = $(CURDIR)/build/bin
2+
GOBINREL = build/bin
3+
GOBIN = $(CURDIR)/$(GOBINREL)
34
UNAME = $(shell uname) # Supported: Darwin, Linux
45
DOCKER := $(shell command -v docker 2> /dev/null)
56

@@ -216,7 +217,7 @@ mocks: mocks-clean
216217

217218
## mocks-clean: cleans all generated test mocks
218219
mocks-clean:
219-
grep -r -l --exclude-dir=erigon-lib "^// Code generated by MockGen. DO NOT EDIT.$$" . | xargs rm -r
220+
grep -r -l --exclude-dir="erigon-lib" --exclude-dir="*$(GOBINREL)*" "^// Code generated by MockGen. DO NOT EDIT.$$" . | xargs rm -r
220221

221222
## solc: generate all solidity contracts
222223
solc:

erigon-lib/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ grpc: protoc-all
7272
txpool/txpool.proto txpool/mining.proto
7373
rm -rf vendor
7474

75-
$(GOBINREL)/mockgen: | $(GOBINREL)
75+
build-mockgen:
7676
$(GOBUILD) -o "$(GOBIN)/mockgen" go.uber.org/mock/mockgen
7777

7878
mocks-clean:
79-
grep -r -l "^// Code generated by MockGen. DO NOT EDIT.$$" . | xargs rm -r
79+
grep -r -l --exclude-dir="*$(GOBINREL)*" "^// Code generated by MockGen. DO NOT EDIT.$$" . | xargs rm -r
8080

81-
mocks: $(GOBINREL)/mockgen mocks-clean
81+
mocks: build-mockgen mocks-clean
8282
PATH="$(GOBIN):$(PATH)" go generate -run "mockgen" ./...
8383

8484
lintci-deps:

0 commit comments

Comments
 (0)