I want to add the current git version number to the binary built with go build so that I can do something like ./mybinary --revision to see which version it is built from (usually to troubleshoot later after deployment ), Obviously, I cannot put the version number in the source, as this will change the source code with the new version. I am wondering if there is another way to do this? Or do you think this is just a bad idea? If so, what is the recommended way to establish a connection between the embedded binaries and the original version? Version numbers do not seem to be a good idea in a distributed version control system.
source share