Get the latest tech news
Building static binaries with Go on Linux
One of Go's advantages is being able to produce statically-linked binaries [1]. This doesn't mean that Go always produces such binaries by default, however; in some scenarios it requires extra work to make this happen.
This post goes over a series of experiments: we take simple programs and use go build to produce binaries on a Linux machine. If we build this program, we notice it's dynamically linked, expecting to load a libc shared object at run-time: These will produce statically-linked Go binaries; the zig driver takes care of setting the right linker flags automatically, so the command-line ends up being slightly simpler than invoking musl-gcc.
Or read this on Hacker News