commit c2bc5a99a084883b184f72be49738abc81b60e2f
parent b44236e83b5d6def071acc58a860b0856aa55139
Author: Sean Enck <sean@ttypty.com>
Date: Sat, 21 Jun 2025 07:45:00 -0400
cleaning up from resorting to makefile
Diffstat:
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,17 +1,18 @@
GOFLAGS := -trimpath -buildmode=pie -mod=readonly -modcacherw -buildvcs=false
TARGET := target
-VERISON := `git log -n 1 --format=%h`
+VERSION := $(shell git log -n 1 --format=%h)
OBJECT := $(TARGET)/lb
-GOTEST := LOCKBOX_CONFIG_TOML=fake go test
+GOTEST := go test
CMD := cmd/lb
-cmd := "cmd/lb"
+
+.PHONY: $(OBJECT)
all: setup $(OBJECT)
setup:
@test -d $(TARGET) || mkdir -p $(TARGET)
-$(OBJECT): go.* cmd/lb/*.go internal/**/*.go internal/**/**/*.go internal/**/**/**/*.*
+$(OBJECT):
go build $(GOFLAGS) -ldflags "$(LDFLAGS) -X main.version=$(VERSION)" -o "$(OBJECT)" $(CMD)/main.go
unittest:
diff --git a/cmd/lb/main_test.go b/cmd/lb/main_test.go
@@ -77,6 +77,7 @@ func TestBoth(t *testing.T) {
}
func run(t *testing.T, profile string) {
+ os.Setenv("LOCKBOX_CONFIG_TOML", "fake")
if err := test(profile); err != nil {
t.Errorf("%s failed: %v", profile, err)
}