github.com/goreleaser/goreleaser@v1.25.1/www/docs/cookbooks/using-main.version.md (about) 1 # Using the `main.version` ldflag 2 3 By default, GoReleaser will set the following 3 _ldflags_: 4 5 - `main.version`: Current Git tag (the `v` prefix is stripped) or the name of 6 the snapshot, if you're using the `--snapshot` flag 7 - `main.commit`: Current git commit SHA 8 - `main.date`: Date in the 9 [RFC3339](https://golang.org/pkg/time/#pkg-constants) format 10 11 You can use them in your `main.go` file to print more build details: 12 13 ```go 14 package main 15 16 import "fmt" 17 18 var ( 19 version = "dev" 20 commit = "none" 21 date = "unknown" 22 ) 23 24 func main() { 25 fmt.Printf("my app %s, commit %s, built at %s", version, commit, date) 26 } 27 ``` 28 29 You can override this by changing the `ldflags` option in the 30 [`build` section](/customization/build/).