github.com/ahmet2mir/goreleaser@v0.180.3-0.20210927151101-8e5ee5a9b8c5/www/docs/cookbooks/using-main.version.md (about)

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