During my Go Tooling in Action Workshop many people ask how to include version information to binaries, so I decided to make an episode out of it!
We will solve the problem using three different techniques:
- constants and build constraints (code)
- variables and build constraints (code)
- variables and ldflags (code)
In each directory you can build the development
and production
releases by running make dev
or make prod
.