github.com/tomsquest/goreleaser@v0.34.3-0.20171008022654-7d6ef4d338b3/docs/025-version.md (about)

     1  ---
     2  title: main.version
     3  ---
     4  
     5  GoReleaser always sets a `main.version` *ldflag*.
     6  You can use it in your `main.go` file:
     7  
     8  ```go
     9  package main
    10  
    11  var version = "master"
    12  
    13  func main() {
    14    println(version)
    15  }
    16  ```
    17  
    18  `version` will be set to the current Git tag (the `v` prefix is stripped) or the name of
    19  the snapshot, if you're using the `--snapshot` flag.
    20  
    21  You can override this by changing the `ldflags` option in the `build` section.