github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/util/build/build.go (about) 1 package build 2 3 import ( 4 "runtime" 5 6 "github.com/prometheus/common/version" 7 prom "github.com/prometheus/prometheus/web/api/v1" 8 ) 9 10 // Version information passed to Prometheus version package. 11 // Package path as used by linker changes based on vendoring being used or not, 12 // so it's easier just to use stable Loki path, and pass it to 13 // Prometheus in the code. 14 var ( 15 Version string 16 Revision string 17 Branch string 18 BuildUser string 19 BuildDate string 20 GoVersion string 21 ) 22 23 func init() { 24 version.Version = Version 25 version.Revision = Revision 26 version.Branch = Branch 27 version.BuildUser = BuildUser 28 version.BuildDate = BuildDate 29 version.GoVersion = runtime.Version() 30 } 31 32 func GetVersion() prom.PrometheusVersion { 33 return prom.PrometheusVersion{ 34 Version: version.Version, 35 Revision: version.Revision, 36 Branch: version.Branch, 37 BuildUser: version.BuildUser, 38 BuildDate: version.BuildDate, 39 GoVersion: version.GoVersion, 40 } 41 }