impr: goreleaser-compatible version, commit and date

This commit is contained in:
Anton
2024-01-18 00:34:49 +05:00
parent 8178918c6e
commit 02473a2b61
2 changed files with 9 additions and 6 deletions

View File

@@ -6,9 +6,7 @@ build_rev := "main"
ifneq ($(wildcard .git),)
build_rev := $(shell git rev-parse --short HEAD)
endif
build_date := $(shell date -u '+%Y%m%d')
version := $(build_date):$(build_rev)
build_date := $(shell date -u '+%Y-%m-%dT%H:%M:%S')
setup:
@go mod download
@@ -24,7 +22,7 @@ test:
build:
@go build -ldflags "-X main.Version=$(version)" -o build/codapi -v cmd/main.go
@go build -ldflags "-X main.commit=$(build_rev) -X main.date=$(build_date)" -o build/codapi -v cmd/main.go
run:
@./build/codapi