gitmyhub

gox

Go ★ 4.6k updated 3y ago ▣ archived

A dead simple, no frills Go cross compile tool

A Go command-line tool that builds your program for every platform, Windows, macOS, Linux, and more, in one command, running all the builds in parallel so it finishes as fast as your slowest single target.

Gosetup: easycomplexity 1/5

Gox is a small command-line tool for Go developers who want to build their program for many operating systems and processor types at once. Normally, compiling a Go program produces a single executable that only works on the computer you built it on. Gox lets you produce executables for Windows, macOS, Linux, FreeBSD, and several other platforms in a single command, without needing a separate machine for each.

The tool is intentionally minimal. It works almost identically to Go's built-in build command, so anyone already familiar with building Go programs can use Gox immediately. You run it in your project folder, optionally specify which operating systems or processor architectures you care about, and Gox handles the rest. By default it targets every platform Go supports.

One practical advantage is that Gox runs multiple builds at the same time, using as many CPU cores as your machine has available. If you need binaries for eight platforms, it does not build them one after the other; it runs them in parallel and finishes faster. The output is a set of separate executable files, one per platform, with no enforced folder structure imposed on you.

You can narrow the output in straightforward ways. Passing a flag for a specific operating system produces only those binaries. Passing a combined operating system and architecture value gives you exactly one build. The tool has a help flag that lists all available options.

Gox is squarely aimed at situations where you want the simplest possible cross-compilation without extra features like package uploading, changelog generation, or installer creation. If you need those extras, other tools in the Go ecosystem cover them. Gox just compiles and stops there.

Where it fits