Use LDFLAGS to set build version

This commit is contained in:
Ryan Cavicchioni 2021-03-02 00:41:55 -06:00
parent c8d0d306e4
commit 4d3074fa14
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,6 @@
LUME_VERSION ?= $(shell git describe --tags --always)
LDFLAGS := ${LDFLAGS} -X git.kill0.net/chill9/lume/cmd.Version=${LUME_VERSION}
ifeq ($(OS), Windows_NT)
EXE=lume.exe
RM=del /f /q
@ -8,7 +11,7 @@ endif
.PHONY: build
build:
go build -o ${EXE} ./cmd/lume
go build -o ${EXE} -ldflags="${LDFLAGS}" ./cmd/lume
.PHONY: clean
clean:

View File

@ -29,7 +29,7 @@ func init() {
RegisterCommand(NewCmdVersion())
}
const Version = "0.1.0-pre"
var Version string = "0.1.0-pre"
const lumercFile string = ".lumerc"