Update version to use a nicer date format
This commit is contained in:
parent
31bf3fca93
commit
61f7a52ef1
2 changed files with 13 additions and 3 deletions
cmd/hoarder
|
@ -9,6 +9,8 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
var buildVersion = "Unknown"
|
||||
|
@ -20,6 +22,14 @@ func main() {
|
|||
flag.Parse()
|
||||
|
||||
if *version {
|
||||
dateUnix, err := strconv.ParseInt(buildDate, 10, 64)
|
||||
if err == nil {
|
||||
date := time.Unix(dateUnix, 0)
|
||||
if !date.IsZero() {
|
||||
buildDate = date.UTC().Format(time.UnixDate)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("%s\n%s\n", buildVersion, buildDate)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue