Skip to content

Commit

Permalink
Merge pull request #10 from CarlJi/init
Browse files Browse the repository at this point in the history
feat: make buildDate as optional
  • Loading branch information
e06084 authored Dec 14, 2022
2 parents 4080361 + 88e74e0 commit 278fa71
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ var (
GitTreeState = unknownProperty
// GitTag shows latest tag if injected by go -ldflags, otherwise it is invisible.
GitTag = unknownProperty
// BuildDate shows the built time for the associated binary.
// Expect to be filled via go -ldflags during compiling.
// BuildDate shows the built time for the associated binary if injected by go -ldflags. otherwise it is invisible.
BuildDate = unknownProperty
// Platform composes with GOARCH and GOOS automatically.
Platform = unknownProperty
Expand Down Expand Up @@ -72,7 +71,10 @@ func Version() {
xprintf(format, "Git state", GitTreeState)
}

xprintf(format, "Built date", BuildDate)
if BuildDate != unknownProperty {
xprintf(format, "Built date", BuildDate)
}

if BuildComments != unknownProperty {
xprintf(format, "Built comments", BuildComments)
}
Expand Down

0 comments on commit 278fa71

Please sign in to comment.