A couple years back, a blog post was shared on Hacker News that talked about why a new startup was using Go for their backend service. It wasn’t about language features or scalability. It was simply the fact that Go’s toolchain is dead easy to use when it comes to cross-compiling static binaries.
For example, if you’re working on an apple silicon laptop and want to “deploy” a
service on a cloud VM, one simple way to do it would be to simply compile with
the proper GOOS
and GOARCH
(for example, linux
and amd64
) and
secure-copy the binary to the VM along with a single config file, and just run
it. You don’t need docker for this, you don’t have to install the correct
dependencies as you would do for many other languages like Python or Ruby, since
the binary is statically linked (in most use-cases).
The ease of cross-compiling and static-linking also makes it very easy to write
script-y programs that you can code once and compile for the target VM(s). If
you’re doing the same with Python, you would need to make sure you installed the
correct dependencies on the VM using requirements.txt
or package your “script”
in docker (ugh).