diff --git a/Makefile b/Makefile index a1ba66f..9879afd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 0.1.0 +VERSION = 0.2.0 COMMIT = $(shell git describe --always) GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*") @@ -6,10 +6,10 @@ default: build # build generate binary on './bin' directory. build: - go build -ldflags "-X main.GitCommit=$(COMMIT)" -o bin/prometheus-http-sd . + go build -ldflags "-X main.Version=$(VERSION)" -o bin/prometheus-http-sd . buildx: - gox -ldflags "-X main.GitCommit=$(COMMIT)" -output "bin/v$(VERSION)/{{.Dir}}_{{.OS}}_{{.Arch}}" -arch "amd64" -os "linux darwin" . + gox -ldflags "-X main.Version=$(VERSION)" -output "bin/v$(VERSION)/{{.Dir}}_{{.OS}}_{{.Arch}}" -arch "amd64" -os "linux darwin" . lint: golint ${GOFILES_NOVENDOR} diff --git a/main.go b/main.go index 49cfa3b..3605a7e 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,8 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" ) +var Version string + const ( metricsNamespace = "prometheus_sd_http" ) @@ -150,6 +152,7 @@ func cancelDiscoverers() { } func main() { + a.Version(Version) a.HelpFlag.Short('h') _, err := a.Parse(os.Args[1:])