Skip to content

Commit 1087c98

Browse files
authored
chore: set -buildvcs=false on go build (#2516)
By default go 1.18+ injects version control info into main packages on build. That's fine. But it's buggy and we don't need it anyway since goreleaser does it for us. So I'm disabling it. Why? If you're building from a linked git worktree (which I do all the time) it'll bomb because go expects the `.git` directory to be the common git root, not a pointer to one. It's a longstanding bug that'll maybe get fixed by go 3.0 golang/go#58218
1 parent a4a8553 commit 1087c98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ endif
5151
$(COG_BINARIES): $(COG_GO_SOURCE) pkg/dockerfile/embed/.wheel
5252
@echo Building $@
5353
@if git name-rev --name-only --tags HEAD | grep -qFx undefined; then \
54-
$(GORELEASER) build --clean --snapshot --single-target --id $@ --output $@; \
54+
GOFLAGS=-buildvcs=false $(GORELEASER) build --clean --snapshot --single-target --id $@ --output $@; \
5555
else \
56-
$(GORELEASER) build --clean --auto-snapshot --single-target --id $@ --output $@; \
56+
GOFLAGS=-buildvcs=false $(GORELEASER) build --clean --auto-snapshot --single-target --id $@ --output $@; \
5757
fi
5858

5959
.PHONY: install

0 commit comments

Comments
 (0)