So, thanks to Redditor vruin, I learned that there’s an easier way to add a version number than what I was doing:
The way described in the blog post uses the
go build parameter instead of my relatively convoluted approach of using
go generate to create a version.go file. I just needed to make a couple of changes to the version scheme to make it work for me:
GOOS=linux GOARCH=amd64 go build -ldflags &quot;-X main.version=`git describe --tags --long`&quot; -o release/terminator
The next thing I needed to do was to package up those builds and push them back out to Github. I followed some excellent instructions, just making a few changes to take out the need for a
I’ve put this into practice on my “Terminator” application at https://github.com/a-h/terminator and I’m now confident I can deploy new distributions of my applications automatically.