go.fuchsia.dev/jiri@v0.0.0-20240502161911-b66513b29486/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 // LINT.IfChange 13 var ( 14 GitCommit string 15 BuildTime string 16 ) 17 18 // LINT.ThenChange(isatty/isatty.go) 19 20 func FormattedVersion() string { 21 var versionString bytes.Buffer 22 if GitCommit != "" { 23 fmt.Fprintf(&versionString, "%s", GitCommit) 24 } 25 if BuildTime != "" { 26 fmt.Fprintf(&versionString, " %s", BuildTime) 27 } 28 return versionString.String() 29 }