Skip to content

Instantly share code, notes, and snippets.

@mmirolim
Created August 27, 2015 08:15
Show Gist options
  • Select an option

  • Save mmirolim/283c131924f9931a8d8f to your computer and use it in GitHub Desktop.

Select an option

Save mmirolim/283c131924f9931a8d8f to your computer and use it in GitHub Desktop.
// go build -ldflags "-X main.BuildStamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X main.GitHash=`git rev-parse HEAD`" main.go
package main
import (
"fmt"
)
var (
BuildStamp = ""
GitHash = ""
)
func main() {
// check variables
fmt.Println("BuildStamp", BuildStamp)
fmt.Println("GitHash", GitHash)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment