Created
May 10, 2016 17:37
-
-
Save dbehnke/52b4eefd998ca5430ed3c0acb5ed916a to your computer and use it in GitHub Desktop.
Using git tags to generate version strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go build -ldflags "-X main.Version=`git describe --tags --long`" test.go | |
./test | |
# 4.16.5-DEV-0-g9a95002 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"fmt" | |
) | |
var Version = "Nothing Set" | |
func main() { | |
fmt.Println(Version) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment