github.com/btwiuse/jiri@v0.0.0-20191125065820-53353bcfef54/version/version.go (about) 1 // Copyright 2016 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package version 6 7 import ( 8 "bytes" 9 "fmt" 10 ) 11 12 var ( 13 GitCommit string 14 BuildTime string 15 ) 16 17 func FormattedVersion() string { 18 var versionString bytes.Buffer 19 if GitCommit != "" { 20 fmt.Fprintf(&versionString, "%s", GitCommit) 21 } 22 if BuildTime != "" { 23 fmt.Fprintf(&versionString, " %s", BuildTime) 24 } 25 return versionString.String() 26 }