github.com/puellanivis/breton@v0.2.16/lib/util/version.go (about) 1 package util 2 3 import ( 4 "strconv" 5 "strings" 6 7 "github.com/puellanivis/breton/lib/os/process" 8 ) 9 10 // BUILD is a value that can be set by the go build command-line 11 // in order to provide additional context information for the build, 12 // such as build timestamp, branch, commit id, etc. 13 var BUILD = "adhoc" 14 15 // Version returns the version information populated during util.Init(). 16 func Version() string { 17 return process.Version() 18 } 19 20 func buildSemver(versions []uint) string { 21 var tmp []string 22 23 if len(versions) < 1 { 24 tmp = append(tmp, "0") 25 } 26 27 for _, ver := range versions { 28 tmp = append(tmp, strconv.FormatUint(uint64(ver), 10)) 29 } 30 31 return "v" + strings.Join(tmp, ".") 32 }