3 ms·
In my build scripts, I like to have this added, so I can see what commit was used in building the binary: go build -ldflags "-X main.versionId `git rev-par
by mathrawka 11y ago
In my build scripts, I like to have this added, so I can see what commit was used in building the binary:
go build -ldflags "-X main.versionId `git rev-parse HEAD`"
- FiloSottile 11y agogit describe --tags --always --dirty="-dev" This will give you just the tag name if the current commit is tagged (useful for version tags), otherwise TAG-N-COMMIT, where N is the number of commits since TAG, and finally append -dev if the tree is dirty.