diff --git a/Makefile b/Makefile index 92d4657..4222674 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,8 @@ -.PHONY: test lint check-fmt fmt +VERSION := 1.0.0 +GIT_COMMIT := $(shell git rev-parse HEAD) +LDFLAGS := -X 'git.eeqj.de/sneak/smartconfig.Version=$(VERSION)' -X 'git.eeqj.de/sneak/smartconfig.GitCommit=$(GIT_COMMIT)' + +.PHONY: test lint check-fmt fmt build test: lint check-fmt go test -v ./... @@ -14,4 +18,7 @@ check-fmt: fi fmt: - go fmt ./... \ No newline at end of file + go fmt ./... + +build: + go build -ldflags "$(LDFLAGS)" -o smartconfig ./cmd/smartconfig \ No newline at end of file diff --git a/version.go b/version.go index 753807c..fb862c8 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ package smartconfig -// Version is the current version of smartconfig -const Version = "1.0.0" +// Version is the current version of smartconfig (set at build time with -ldflags) +var Version = "dev" // GitCommit is the git commit hash (set at build time with -ldflags) var GitCommit = "unknown"