concept binary in category go

appears as: binary, binaries, The binary, The binaries
Go in Practice

This is an excerpt from Manning's book Go in Practice.

GOPATH is one environment variable that the go executable expects to exist. GOPATH tells Go where your workspace is to import packages, install binaries, and store intermediate archives. The following example creates a workspace in a directory named go on a UNIX-like system:

Technique 42 Embedding files in a binary

Sometimes you’ll want to include assets right inside the application binary. Then, instead of looking for them on the filesystem, they’re included in the application binary. This can be useful when distributing an application. The binary is the only thing needing to be distributed, rather than a collection of files to accompany it.

go.rice enables you to work with files from the filesystem during development (for example, when using go run), to use files embedded in the built binary, and to build files into binaries. The following listing showcases simple file serving using go.rice.

Listing 7.7. Embedding files in binaries with go.rice: embedded_files.go