Skip to content

Files

Latest commit

 

History

History
16 lines (10 loc) · 477 Bytes

compile-specific-arch.md

File metadata and controls

16 lines (10 loc) · 477 Bytes

Compile for a Specific Architecture

  • To compile for a specific platform and architecture prefix go build with GOOS and GOARCH environment variables.
  • Go can compile for a target platform regardless of the host platform (e.g. compile for Windows on macOS).
# Build for Windows 64 bit

env GOOS=windows GOARCH=amd64 go build -o my_program_win_amd64 .

Refs

  • List out all platform and architecture combinations with go tool dist list