Makefile: allow command-specific go.mod files (#3641)

The command builds were always using the root go.mod.
Adding cmd/mycmd/go.mod produced an "package not found" error.

This changes the build to run in the cmd/mycmd directory:
* If cmd/mycmd/go.mod is present, it is used.
* Otherwise it builds the main package using the root go.mod as before.
This commit is contained in:
battlmonstr 2022-03-04 01:47:09 +01:00 committed by GitHub
parent d470349830
commit 90b52929c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,7 @@ dbg:
%.cmd: git-submodules
@# Note: $* is replaced by the command name
@echo "Building $*"
@$(GOBUILD) -o $(GOBIN)/$* ./cmd/$*
@cd ./cmd/$* && $(GOBUILD) -o $(GOBIN)/$*
@echo "Run \"$(GOBIN)/$*\" to launch $*."
geth: erigon