Skip to content

Commit

Permalink
fix reproducibility by not using the linker for version injection
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav committed Mar 6, 2024
1 parent 1e562fd commit 41983f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bin/
etc/waas-auth.conf
etc/id_rsa
etc/id_rsa.pub
version.go
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define build
go build -v \
-trimpath \
-buildvcs=false \
-ldflags='-X "github.com/0xsequence/waas-authenticator.VERSION=$(VERSION)" -s -w -buildid=' \
-ldflags='-s -w -buildid=' \
-o ./bin/$(1) \
./cmd/$(1)
endef
Expand All @@ -47,6 +47,7 @@ proto:

clean:
rm -rf ./bin/*
rm -rf version.go
go clean -cache -testcache

test: test-clean
Expand All @@ -55,10 +56,13 @@ test: test-clean
test-clean:
GOGC=off go clean -testcache

eif: ensure-version clean
eif: clean ensure-version
mkdir -p bin
docker build --platform linux/amd64 --build-arg VERSION=$(VERSION) --build-arg ENV_ARG=$(ENV) -t waas-authenticator-builder .
docker run --platform linux/amd64 -v $(TOP)/bin:/out waas-authenticator-builder waas-auth.$(VERSION)

ensure-version:
test -n "$(VERSION)"
rm -rf version.go
echo "package waasauthenticator" > version.go
echo "const VERSION = \"$(VERSION)\"" >> version.go
3 changes: 0 additions & 3 deletions version.go

This file was deleted.

0 comments on commit 41983f8

Please sign in to comment.