LinuxCommandLibrary

gox

Go cross-compilation tool

TLDR

Build for all platforms

$ gox
copy
Build for specific platforms
$ gox -osarch="linux/amd64 darwin/amd64"
copy
Build specific package
$ gox [./cmd/app]
copy
Set output path
$ gox -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
copy
Parallel builds
$ gox -parallel=[4]
copy

SYNOPSIS

gox [options] [packages]

DESCRIPTION

gox is a simple Go cross-compilation tool that builds Go binaries for multiple platforms in parallel. It wraps `go build` with convenient cross-compilation options and templated output paths using OS and architecture variables.
The tool simplifies creating release builds for multiple target platforms from a single command.

PARAMETERS

PACKAGES

Packages to build.
-osarch TARGETS
OS/arch combinations.
-os OS
Target operating systems.
-arch ARCH
Target architectures.
-output PATTERN
Output path pattern.
-parallel N
Parallel builds.
--help
Display help information.

CAVEATS

CGO may complicate cross-compile. Large number of targets is slow. Consider goreleaser for releases.

HISTORY

gox was created by Mitchell Hashimoto (HashiCorp) to simplify building Go binaries for multiple platforms.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community