Go’s best friend: UPX, the executable compressor

JM Robles
2 min readJun 14, 2020
The efficient dream team

When you start to develop with Go (a.k.a. Golang), one thing you realize is that the generated executable is “big”. A simple HTTP “Hello world” app has a size around 7 MB (depends on the OS and architecture).

For many cases is not a problem, but if you need to transfer it through Internet or to store it in an embedded device… it’s not good.

Introducing UPX

The Ultimate Packer for eXecutables, UPX, is an executable compressor with very fast decompression time for many of architecture-OS combinations.

The most important architectures are supported: i386, x86_64, arm64, armeb, powerpc, etc.

Regarding OSs, Windows, Linux, BSD and even DOS are supported too.

It’s very easy to install and to use.

In Mac OS X

brew install upx

In Ubuntu

sudo apt install upx

Deflating our Go app

We use this HTTP Server example in go.

--

--

JM Robles
JM Robles

Written by JM Robles

AIOps @ Montevive.ai / Backend / Platform engineer #llm #rag #llamaindex #langchain #go #python #kubernetes #terraform #devops

No responses yet