Skip to content

Commit

Permalink
make: fix gen issue with mockgen not found in PATH (#10162)
Browse files Browse the repository at this point in the history
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 🙃
  • Loading branch information
taratorio committed May 1, 2024
1 parent 82262fe commit ee0f56b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GO ?= go # if using docker, should not need to be installed/linked
GOBIN = $(CURDIR)/build/bin
GOBINREL = build/bin
GOBIN = $(CURDIR)/$(GOBINREL)
UNAME = $(shell uname) # Supported: Darwin, Linux
DOCKER := $(shell command -v docker 2> /dev/null)

Expand Down Expand Up @@ -216,7 +217,7 @@ mocks: mocks-clean

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

## solc: generate all solidity contracts
solc:
Expand Down
6 changes: 3 additions & 3 deletions erigon-lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ grpc: protoc-all
txpool/txpool.proto txpool/mining.proto
rm -rf vendor

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

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

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

lintci-deps:
Expand Down

0 comments on commit ee0f56b

Please sign in to comment.