Cross compile a Go binary
Build and cross-compile a Go binary for Linux, Windows, and Darwin architectures.
Use template →1steps:
2 - label: ":golang: Cross compile"
3 plugins:
4 - golang-cross-compile#v1.4.0:
5 build: main.go
6 targets:
7 - version: "1.11"
8 goos: linux
9 goarch: amd64
10 gomodule: "on"
11 - version: "1.11"
12 goos: windows
13 goarch: amd64
14 gomodule: "on"
15 - version: "1.11"
16 goos: darwin
17 goarch: amd64
18 gomodule: "on"
- Languages
- Go
- Use cases
- Continuous integration
Compile Go binary
Build and cross-compile a Go binary for Linux, Windows, and Darwin architectures.
Use template →Cross compile a Go binary
This template gives you a continuous integration (CI) pipeline that compiles a Go binary for multiple targets.
At a glance:
- For Golang projects
- Uses the Golang Cross Compile Buildkite Plugin
- Compiles for Linux, Windows, and Darwin architectures.
How it works
This template:
- Builds your Go project.
- Cross-compiles for Linux, Windows, and Darwin architectures.
Next steps
After you select Use template, you’ll:
- Connect the Git repository with your Go code.
- Configure the compute—run locally, on-premises, or in the cloud.
- Run the pipeline.
You can then play around with the pipeline settings. For example, run the pipeline locally while you iterate on the definition or set a schedule to trigger a nightly build.
If you need help, please check our documentation, raise an issue , or reach out to support.