Simple wrapper around go build
to allow getting the git hash and injecting it into a variable
go get -u github.com/golang-devops/go-build-git
package main
var (
GitHash = "NO GIT HASH"
)
func main() {
fmt.Println(fmt.Sprintf("Running git hash '%s'", GitHash))
}
go-build-git -out "./tmpbinary" -injectvar "main.GitHash"
./tmpbinary