A better way than “ldflags” to add a build version to your Go binaries

Andrew Hayes
Level Up Coding
Published in
3 min readJan 18, 2022

--

Like a lot of people using Go, I used “ldflags” to add the version number to my binaries. It worked great, every time a binary was built, it pulled the version from “git describe” and add that version to a variable in the binary. Then when testing and a bug was found I would know what version of the binary I found it in and all was right with the world. That is until I…

--

--