Tag your git repository with a version number (ideally based on the semantic versioning specification e.g. v0.0.0).
git tag -a v0.0.0 -m "First tag."
Push the version number to the remote repository.
git push --tags
Generate an up-to-date version_PLATFORM.go file (normally done by your CI server)
go generate
The version_PLATFORM.go file gets automatically updated with data from the tag.
Build as normal
go build
overwite commit to an existing TAG
git push --tags -f