Skip to content

Commit

Permalink
embed git tag and build time + display at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
the-gigi committed Jul 3, 2020
1 parent 40d7c33 commit b6d2174
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env zsh

go build -ldflags "-X 'main.GitTag=$(git describe --tags)' -X 'main.Timestamp=$(date -u)'"

11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
package main

import (
"fmt"

"github.com/the-gigi/multi-git/cmd"
)

var (
GitTag string
Timestamp string
)

func main() {
if GitTag != "" {
fmt.Printf("Git tag : %s\nBuilt at: %s\n\n", GitTag, Timestamp)
}

cmd.Execute()
}

0 comments on commit b6d2174

Please sign in to comment.