Fix version info string.

Broken by the following commit
e38bb7c Use Makefile.COMMON and add generated files.go
This commit is contained in:
Sharif Nassar 2015-09-02 14:41:57 -07:00
parent e0b4817d13
commit 17e4cf0d30
2 changed files with 20 additions and 6 deletions

View File

@ -16,6 +16,18 @@ TARGET := alertmanager
include Makefile.COMMON include Makefile.COMMON
REV := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown')
BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown')
HOSTNAME := $(shell hostname -f)
BUILD_DATE := $(shell date +%Y%m%d-%H:%M:%S)
GOFLAGS := -ldflags \
"-X=main.buildVersion $(VERSION)\
-X=main.buildRevision $(REV)\
-X=main.buildBranch $(BRANCH)\
-X=main.buildUser $(USER)@$(HOSTNAME)\
-X=main.buildDate $(BUILD_DATE)\
-X=main.goVersion $(GO_VERSION)"
web: web/blob/files.go web: web/blob/files.go
web/blob/files.go: $(shell find web/templates/ web/static/ -type f) web/blob/files.go: $(shell find web/templates/ web/static/ -type f)

View File

@ -19,17 +19,19 @@ import (
// Build information. Populated by Makefile. // Build information. Populated by Makefile.
var ( var (
buildVersion string buildVersion string
buildBranch string buildRevision string
buildUser string buildBranch string
buildDate string buildUser string
goVersion string buildDate string
goVersion string
) )
// BuildInfo encapsulates compile-time metadata about Prometheus made available // BuildInfo encapsulates compile-time metadata about Prometheus made available
// via go tool ld such that this can be reported on-demand. // via go tool ld such that this can be reported on-demand.
var BuildInfo = map[string]string{ var BuildInfo = map[string]string{
"version": buildVersion, "version": buildVersion,
"revision": buildRevision,
"branch": buildBranch, "branch": buildBranch,
"user": buildUser, "user": buildUser,
"date": buildDate, "date": buildDate,
@ -37,7 +39,7 @@ var BuildInfo = map[string]string{
} }
var versionInfoTmpl = template.Must(template.New("version").Parse( var versionInfoTmpl = template.Must(template.New("version").Parse(
`alertmanager, version {{.version}} ({{.branch}}) `alertmanager, version {{.version}} ({{.branch}}@{{.revision}})
build user: {{.user}} build user: {{.user}}
build date: {{.date}} build date: {{.date}}
go version: {{.go_version}} go version: {{.go_version}}