commit 284e8de0e0b7635203395c22bf2927da72165200
parent f4d31da65eebbc191cda343d50a02abd6c0edced
Author: Sean Enck <sean@ttypty.com>
Date: Mon, 19 Sep 2022 18:20:46 -0400
version handling
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,4 +1,3 @@
-VERSION := development
DESTDIR :=
BUILD := bin/
TARGET := $(BUILD)lb
@@ -9,7 +8,8 @@ TESTDIR := $(sort $(dir $(wildcard internal/**/*_test.go)))
all: $(TARGET)
$(TARGET): cmd/main.go internal/**/*.go go.*
- go build -ldflags '-X main.version=$(VERSION)' -trimpath -buildmode=pie -mod=readonly -modcacherw -o $@ cmd/main.go
+ ./contrib/version
+ go build -trimpath -buildmode=pie -mod=readonly -modcacherw -o $@ cmd/main.go
$(TESTDIR):
cd $@ && go test
diff --git a/cmd/main.go b/cmd/main.go
@@ -2,6 +2,7 @@
package main
import (
+ _ "embed"
"errors"
"fmt"
"os"
@@ -19,7 +20,8 @@ import (
)
var (
- version = "development"
+ //go:embed "vers.txt"
+ version string
)
type (