GoReleaser "build failed: exit status 1" in CI
GoReleaser runs go build for every target in the matrix. When one build exits non-zero, GoReleaser reports "build failed: exit status 1" and the real compiler error is in the output just above it.
What this error means
GoReleaser prints a go compiler error, then "build failed: ... exit status 1" naming the failing GOOS/GOARCH target and stops the release.
Terminal
⨯ build failed error=failed to build for linux_amd64:
# github.com/acme/app/internal/svc
internal/svc/handler.go:41:2: undefined: NewClient
exit status 1Common causes
A compile error in the code
The package does not build; the exit status 1 wraps an ordinary go build failure such as an undefined symbol.
A target-specific build constraint
Code that compiles on one GOOS/GOARCH may fail on another due to build tags or platform-specific APIs.
How to fix it
Read the go compiler error above the summary
- Scroll up to the first
.go:line in the output to find the real error. - Fix the compile error or guard platform-specific code with build tags.
- Reproduce locally with
go build ./...before re-releasing.
Terminal
go build ./...
goreleaser build --snapshot --clean --single-targetLimit targets while debugging
Use --single-target to build only the host platform, isolating whether the failure is platform-specific.
Terminal
goreleaser build --single-target --snapshot --cleanHow to prevent it
- Run
go build ./...in CI before GoReleaser. - Guard platform-specific code with build constraints.
- Test the full target matrix with
goreleaser build --snapshot.
Related guides
GoReleaser cgo "gcc: not found" build error in CIFix GoReleaser cgo "gcc not found" in CI - a cross-compiled cgo build needs a C toolchain the runner lacks, o…
GoReleaser "unsupported GOOS/GOARCH pair" in CIFix GoReleaser "unsupported GOOS/GOARCH pair" in CI - a target platform combination in the build matrix is no…
GoReleaser "goreleaser check" config validation fails in CIFix "goreleaser check" failures in CI - the config validation step reports deprecated, invalid, or missing fi…