From 9f5ae819e250cc011d6c2475ba81ef9657a6b7c2 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 5 Apr 2016 22:36:54 +0200 Subject: [PATCH] Use runtime.Version() --- scripts/build.sh | 2 -- version/info.go | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index edf56215e..a25dc9d8d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -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' ) host=$( hostname ) 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 ext=".exe" @@ -34,7 +33,6 @@ ldflags=" -X ${repo_path}/version.Branch=${branch} -X ${repo_path}/version.BuildUser=${USER}@${host} -X ${repo_path}/version.BuildDate=${build_date} - -X ${repo_path}/version.GoVersion=${go_version} ${EXTRA_LDFLAGS}" export GO15VENDOREXPERIMENT="1" diff --git a/version/info.go b/version/info.go index 835fc5ce6..8e43b5726 100644 --- a/version/info.go +++ b/version/info.go @@ -13,7 +13,11 @@ package version -import "github.com/prometheus/client_golang/prometheus" +import ( + "runtime" + + "github.com/prometheus/client_golang/prometheus" +) // Build information. Populated at build-time. var ( @@ -22,7 +26,7 @@ var ( Branch string BuildUser string BuildDate string - GoVersion string + GoVersion = runtime.Version() ) // Map provides the iterable version information.