Skip to content

Commit

Permalink
Add --version and bump up version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryota Yoshikawa committed Oct 18, 2019
1 parent bcb3662 commit 39aa220
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
VERSION = 0.1.0
VERSION = 0.2.0
COMMIT = $(shell git describe --always)
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")

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}
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
)

var Version string

const (
metricsNamespace = "prometheus_sd_http"
)
Expand Down Expand Up @@ -150,6 +152,7 @@ func cancelDiscoverers() {
}

func main() {
a.Version(Version)
a.HelpFlag.Short('h')

_, err := a.Parse(os.Args[1:])
Expand Down

0 comments on commit 39aa220

Please sign in to comment.