Skip to main content

The power of a single binary

How do you package a web application written in Python? The process looks something on these lines:

  1. Create a virtualenv.
  2. Arrange all your .py files under different relevant folder.
  3. Write a setup.py optionally.
  4. Freeze all the requirements and dependencies.

We finally take all these artifacts and bake it as part of a container image and run the application.

In case of Java, it is someting similar, except we roll it all up into a single jar and deploy it. In most other languages(Ruby, PHP et al) are variations of the same principles.

For Golang, it is just a single binary. You can structure your code in any way you want, and run a single command to compile the code, and you get ONE binary. You simply ship it to your container/VM/production environment and you’re done. Simpler delivery, smaller images, less dependencies and footprint.

There are some workarounds like shiv which help you mimic the same behaviour in Python, sort of. But it is hard to beat the power and simplicity of shipping a single binary.