Size comparison of Go executables

From version 1.7.6 to 1.16rc1

Petr Jahoda
ITNEXT
Published in
5 min readFeb 16, 2021

--

Original Gopher image created by Renee French, used Gopher image created by Maria Letta

Go programming language originates to 2007, with its public appearance in 2009. As any other programming language, it is growing and changing.

In our company, we use Go a lot. Our system is a combination of different micro services and is deployed over internet. Every update is done over internet also, testing is done over internet, pair development is done over internet, … everything is done over internet.

And that is the reason we like to have our binaries as small as possible. From one point of view, we are not wasting network resources. From different point of view, we are not wasting our time, waiting for the transfer to complete.

We did two things to make our binaries smaller. At first, we changed our builds to use -ldflags=”-s -w”. Then we started to use upx.

Both steps helped us a lot.

And because we are not perfect, there are still some installation running legacy code, that was not updated, from different reasons. Someone someday asked a simple question. How much those executables differ, if you compare one Go version to another? Will it make sense to update those installations running legacy code?

--

--