Skip to content

Instantly share code, notes, and snippets.

@simbados
Created February 14, 2024 19:35
Show Gist options
  • Save simbados/b7e332c7ec4b0abfc2f5403735150bb3 to your computer and use it in GitHub Desktop.
Save simbados/b7e332c7ec4b0abfc2f5403735150bb3 to your computer and use it in GitHub Desktop.
Reproducible build for your go binaries

If you build your binaries in a pipeline you want them to be reproducible across platforms. Build your program with
env GOOS=<system> GOARCH=<architecture> CGO_ENABLED=0 go build -trimpath main.go

Replace with your desired system. Replace with your desired architecture.

Options can be found here: https://go.dev/src/go/build/syslist.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment