You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build.make: support binaries outside of cmd, with optional go.mod
Setting CMDS_DIR in the top-level Makefile before including build.make will
ensure that binaries are picked up from that other directory. This is useful
for lib-volume-populator where an example populator is provided under
"example".
The commands are no longer expected to share the go.mod file with the
project. Entering the command directory and using `go build .` will pick up a
local go.mod if it exists and otherwise fall back to the project's go.mod.
if ! [ $${#os_arch_seen_pre} = $${#os_arch_seen} ]; then \
91
95
continue; \
92
96
fi; \
93
-
if ! (set -x; CGO_ENABLED=0 GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '$(FULL_LDFLAGS)' -o "./bin/$*$$suffix" ./cmd/$*); then \
97
+
if ! (set -x; cd ./$(CMDS_DIR)/$* && CGO_ENABLED=0 GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '$(FULL_LDFLAGS)' -o "$(abspath ./bin)/$*$$suffix" .); then \
94
98
echo "Building $* for GOOS=$$os GOARCH=$$arch failed, see error(s) above."; \
0 commit comments