dockerimg: fix VCS stamping error when building with race detector
When building the sketch binary with race detector enabled in Docker,
Go's VCS stamping feature was failing with 'error obtaining VCS status:
exit status 128' because it couldn't properly determine the Git status
in the mounted repository (especially in detached HEAD states).
This adds -buildvcs=false to the Docker build command to disable VCS
stamping when building with the race detector, which avoids the error
while still enabling race detection functionality.
The fix changes the Docker build command from:
go build -race -o /tmp/sketch-out/sketch sketch.dev/cmd/sketch
to:
go build -buildvcs=false -race -o /tmp/sketch-out/sketch sketch.dev/cmd/sketch
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: sb8b2e8656c0802f6k
diff --git a/dockerimg/dockerimg.go b/dockerimg/dockerimg.go
index 8c0758c..47d144e 100644
--- a/dockerimg/dockerimg.go
+++ b/dockerimg/dockerimg.go
@@ -1065,7 +1065,7 @@
"-v", gitRoot + ":/app",
"-w", "/app",
imgName,
- "sh", "-c", "cd /app && mkdir -p /tmp/sketch-out && go build -race -o /tmp/sketch-out/sketch sketch.dev/cmd/sketch",
+ "sh", "-c", "cd /app && mkdir -p /tmp/sketch-out && go build -buildvcs=false -race -o /tmp/sketch-out/sketch sketch.dev/cmd/sketch",
}
out, err := combinedOutput(ctx, "docker", runArgs...)