Get version from ldflags

This commit is contained in:
Manuel Rüger
2025-06-12 13:29:46 +02:00
parent 8c061c49d4
commit 733b3222b3
2 changed files with 10 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
NAME = $(notdir $(PWD))
VERSION = $(shell git describe --tags --abbrev=0)
COMMIT = $(shell git rev-parse HEAD)
GO111MODULE = on
REMOTE = kovetskiy
@@ -15,7 +15,7 @@ get:
build:
@echo :: building go binary $(VERSION)
CGO_ENABLED=0 go build \
-ldflags "-X main.version=$(VERSION)" \
-ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT)" \
-gcflags "-trimpath $(GOPATH)/src"
test: