lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 507006b3ab38e7389ff007e1bdd5e35c3ca4f177
parent 8cf85e6dd4a413f70128966b279a85b8a6e84cb1
Author: Sean Enck <sean@ttypty.com>
Date:   Tue, 13 Jun 2023 18:44:15 -0400

embed version differently

Diffstat:
MMakefile | 14++++++--------
Mcmd/main.go | 2--
Dcmd/vers.txt | 2--
3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,17 +1,16 @@ BUILD := bin/ TARGET := $(BUILD)lb +VERSION := +ifeq ($(VERSION),) +VERSION := $(shell git log -n 1 --format=%h) +endif all: $(TARGET) build: $(TARGET) $(TARGET): cmd/main.go internal/**/*.go go.* internal/cli/completions* - @! test -d .git || make .version | grep 'version:' | cut -d ':' -f 2 | tr '\n' '_' | sed 's/_//g' > cmd/vers.txt - go build $(GOFLAGS) -o $@ cmd/main.go - -.version: - @git describe --tags --abbrev=0 | sha256sum | cut -c 1-7 | sed 's/^/version:/g' - @git tag --points-at HEAD | grep -q '' || echo "version:-1" + go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o $@ cmd/main.go unittests: go test -v ./... @@ -25,8 +24,7 @@ clean: .runci: rm -rf .git - make build - make check + make build check VERSION=$(GITHUB_SHA) install: install -Dm755 $(TARGET) $(BINDIR)/lb diff --git a/cmd/main.go b/cmd/main.go @@ -2,7 +2,6 @@ package main import ( - _ "embed" "errors" "fmt" "os" @@ -18,7 +17,6 @@ import ( "github.com/enckse/lockbox/internal/totp" ) -//go:embed "vers.txt" var version string func main() { diff --git a/cmd/vers.txt b/cmd/vers.txt @@ -1 +0,0 @@ -a934c11-1 -\ No newline at end of file