Stamp the git tag or short commit into the binary (closes #10)
check / check (push) Failing after 3s
check / check (push) Failing after 3s
rtnetmon had no version. main.Version is now set at link time and logged in the first startup line. `make build` and `make dev` set it from `git describe --tags --always` unless VERSION is given. The Dockerfile takes it from the VERSION build argument when one is given, otherwise from `git describe --tags --always` of the .git the build context now carries, and fails the build if the context carries .git and no version comes out. .dockerignore follows the canonical copy: .git is sent, .git/config, which can hold a credential, is not. Model: opus-5-5
This commit was merged in pull request #11.
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
# below are thin shims that call them.
|
||||
.DEFAULT_GOAL := check
|
||||
|
||||
VERSION ?= $(shell git describe --tags --always)
|
||||
|
||||
bootstrap:
|
||||
@script/bootstrap
|
||||
|
||||
@@ -36,13 +38,14 @@ hooks:
|
||||
@script/install-precommit
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 go build -trimpath -o bin/rtnetmon ./cmd/rtnetmon
|
||||
CGO_ENABLED=0 go build -trimpath -ldflags "-X main.Version=$(VERSION)" \
|
||||
-o bin/rtnetmon ./cmd/rtnetmon
|
||||
|
||||
run: build
|
||||
./bin/rtnetmon
|
||||
|
||||
dev:
|
||||
go run ./cmd/rtnetmon
|
||||
go run -ldflags "-X main.Version=$(VERSION)" ./cmd/rtnetmon
|
||||
|
||||
deps:
|
||||
go mod download
|
||||
|
||||
Reference in New Issue
Block a user