What are the pros and cons of Golang and why does HashiCorp prefer it for our projects? More importantly how does it simplify your customer experience

What’s With All the Go?

submited by
Style Pass
2021-06-16 13:00:08

What are the pros and cons of Golang and why does HashiCorp prefer it for our projects? More importantly how does it simplify your customer experience? I’ll consider this an outside perspective because my own history as a coder tends to be very low-level in the memory management and kernel space of C and C++. I have also worked supporting many projects based on JIT and scripting options like Java, .NET, Python, and Ruby. I will consider Go objectively with all advantages and disadvantages. Maybe you aren’t technical and you don’t care but this definitely has an effect on your business if you’re using HashiCorp.

In the grand scheme of programming Golang is a language created by Google that produces independent compiled binaries which are easy to distribute and support. Dynamic compilation is possible with CGO but by default Go prefers static compilation. All of our products besides Vagrant are statically linked optimized binaries with automatic memory management. Dependencies are all baked into our builds for all of our tools and services. You can tell that by running ldd on a program to list its dynamic libraries. Go binaries not built with CGO will yield a not a dynamic executable result, but Nomad is currently the only HashiCorp build requiring CGO for system access. Therefore Nomad has minimal dynamic links.

Many of the common binaries in any Linux machine are just a few kb in size but rely on up to ~200 shared object files to be available and compatible. This is why Continuous Integration testing is so important when a distribution has complex mappings of M:N libraries to binaries. It also saves loads of storage and memory as there is no need to redundantly store things like libCurl and libPAM for common operations. Conversely Go binaries are relatively large in storage. In fact, if I sort all of my system-level binaries by size, I find a surprising amount of storage being used by our own HashiCorp software. Of the 3.0GB constituting my /usr/bin/ directory, a whopping 749MB of it constitute our projects. Vagrant uses Ruby scripting and thus doesn’t actually contribute here.

Leave a Comment