mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Use runtime.Version()
This commit is contained in:
parent
9ee91062c4
commit
9f5ae819e2
|
@ -22,7 +22,6 @@ revision=$( git rev-parse --short HEAD 2> /dev/null || echo 'unknown' )
|
||||||
branch=$( git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown' )
|
branch=$( git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown' )
|
||||||
host=$( hostname )
|
host=$( hostname )
|
||||||
build_date=$( TZ=UTC date +%Y%m%d-%H:%M:%S )
|
build_date=$( TZ=UTC date +%Y%m%d-%H:%M:%S )
|
||||||
go_version=$( go version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/' )
|
|
||||||
|
|
||||||
if [ "$(go env GOOS)" = "windows" ]; then
|
if [ "$(go env GOOS)" = "windows" ]; then
|
||||||
ext=".exe"
|
ext=".exe"
|
||||||
|
@ -34,7 +33,6 @@ ldflags="
|
||||||
-X ${repo_path}/version.Branch=${branch}
|
-X ${repo_path}/version.Branch=${branch}
|
||||||
-X ${repo_path}/version.BuildUser=${USER}@${host}
|
-X ${repo_path}/version.BuildUser=${USER}@${host}
|
||||||
-X ${repo_path}/version.BuildDate=${build_date}
|
-X ${repo_path}/version.BuildDate=${build_date}
|
||||||
-X ${repo_path}/version.GoVersion=${go_version}
|
|
||||||
${EXTRA_LDFLAGS}"
|
${EXTRA_LDFLAGS}"
|
||||||
|
|
||||||
export GO15VENDOREXPERIMENT="1"
|
export GO15VENDOREXPERIMENT="1"
|
||||||
|
|
|
@ -13,7 +13,11 @@
|
||||||
|
|
||||||
package version
|
package version
|
||||||
|
|
||||||
import "github.com/prometheus/client_golang/prometheus"
|
import (
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
)
|
||||||
|
|
||||||
// Build information. Populated at build-time.
|
// Build information. Populated at build-time.
|
||||||
var (
|
var (
|
||||||
|
@ -22,7 +26,7 @@ var (
|
||||||
Branch string
|
Branch string
|
||||||
BuildUser string
|
BuildUser string
|
||||||
BuildDate string
|
BuildDate string
|
||||||
GoVersion string
|
GoVersion = runtime.Version()
|
||||||
)
|
)
|
||||||
|
|
||||||
// Map provides the iterable version information.
|
// Map provides the iterable version information.
|
||||||
|
|
Loading…
Reference in a new issue