Skip to content

Commit

Permalink
Fix version flags for use with goreleaser.
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasher committed Sep 21, 2018
1 parent cec57c9 commit 4805445
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ func init() {
}

var (
buildDate string // date -u '+%Y-%m-%d'
commitHash string // git rev-parse HEAD
buildTag = "dev" // v#.#.#
buildDate = "unknown" // date -u '+%Y-%m-%d'
commitHash = "unknown" // git rev-parse HEAD
)

func main() {
Expand All @@ -237,14 +238,9 @@ func main() {
rcvr.HandleFlags()

if *version {
if buildDate == "" || commitHash == "" {
fmt.Println("Built from source.")
fmt.Println("Build Date: Unknown")
fmt.Println("Commit: Unknown")
} else {
fmt.Println("Build Date:", buildDate)
fmt.Println("Commit: ", commitHash)
}
fmt.Println("Build Tag: ", buildTag)
fmt.Println("Build Date:", buildDate)
fmt.Println("Commit: ", commitHash)
os.Exit(0)
}

Expand Down

0 comments on commit 4805445

Please sign in to comment.