Skip to content

Commit 4805445

Browse files
committed
Fix version flags for use with goreleaser.
1 parent cec57c9 commit 4805445

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

main.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ func init() {
225225
}
226226

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

232233
func main() {
@@ -237,14 +238,9 @@ func main() {
237238
rcvr.HandleFlags()
238239

239240
if *version {
240-
if buildDate == "" || commitHash == "" {
241-
fmt.Println("Built from source.")
242-
fmt.Println("Build Date: Unknown")
243-
fmt.Println("Commit: Unknown")
244-
} else {
245-
fmt.Println("Build Date:", buildDate)
246-
fmt.Println("Commit: ", commitHash)
247-
}
241+
fmt.Println("Build Tag: ", buildTag)
242+
fmt.Println("Build Date:", buildDate)
243+
fmt.Println("Commit: ", commitHash)
248244
os.Exit(0)
249245
}
250246

0 commit comments

Comments
 (0)