From 264bcbc78c2cea318de1c25ed2ad9c2e996fcbea Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 19 Apr 2014 16:40:19 +0200 Subject: [PATCH] Always print long version at startup --- cmd/syncthing/main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 1ba0a0592..b5e86c098 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -29,14 +29,18 @@ import ( const BlockSize = 128 * 1024 var ( - Version = "unknown-dev" - BuildStamp = "0" - BuildDate time.Time + Version = "unknown-dev" + BuildStamp = "0" + BuildDate time.Time + LongVersion string ) func init() { stamp, _ := strconv.Atoi(BuildStamp) BuildDate = time.Unix(int64(stamp), 0) + + date := BuildDate.UTC().Format(time.RFC3339) + LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s) %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, date) } var ( @@ -89,8 +93,7 @@ func main() { } if showVersion { - date := BuildDate.UTC().Format(time.RFC3339) - fmt.Printf("syncthing %s (%s %s-%s) %s\n", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, date) + fmt.Println(LongVersion) return } @@ -118,7 +121,7 @@ func main() { log.SetPrefix("[" + myID[0:5] + "] ") logger.SetPrefix("[" + myID[0:5] + "] ") - infoln("Version", Version) + infoln(LongVersion) infoln("My ID:", myID) // Prepare to be able to save configuration