Skip to content
Latchkey

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 1

Common 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

  1. Scroll up to the first .go: line in the output to find the real error.
  2. Fix the compile error or guard platform-specific code with build tags.
  3. Reproduce locally with go build ./... before re-releasing.
Terminal
go build ./...
goreleaser build --snapshot --clean --single-target

Limit 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 --clean

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →