Skip to content

Simple wrapper around `go build` to allow getting the git hash and injecting it into a variable

License

Notifications You must be signed in to change notification settings

golang-devops/go-build-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-build-git

Simple wrapper around go build to allow getting the git hash and injecting it into a variable

Quick Start

Install this package binary with

go get -u github.com/golang-devops/go-build-git

Define your main.go file:

package main

var (
    GitHash = "NO GIT HASH"
)

func main() {
    fmt.Println(fmt.Sprintf("Running git hash '%s'", GitHash))
}

Now inside the main file directory run:

go-build-git -out "./tmpbinary" -injectvar "main.GitHash"
./tmpbinary

About

Simple wrapper around `go build` to allow getting the git hash and injecting it into a variable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages