From 41e483d080ffec7098ff8a4cb6f3626a90b969aa Mon Sep 17 00:00:00 2001 From: Lars Ekman Date: Sun, 24 Jul 2022 14:36:41 +0200 Subject: [PATCH] Include example in go.work And use $VERSION in binaries --- go.work | 4 ++++ hack/go-build | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go.work b/go.work index 7f380b62a..6514f666a 100644 --- a/go.work +++ b/go.work @@ -10,5 +10,9 @@ use ( ./backends/windows/userspace ./client ./cmd + ./examples/iptables-extip + ./examples/pipe-exec + ./examples/print-state + ./examples/userspace-proxier ./server ) diff --git a/hack/go-build b/hack/go-build index 957c7e284..71c0fb531 100755 --- a/hack/go-build +++ b/hack/go-build @@ -1,2 +1,3 @@ set -ex -CGO_ENABLED=1 go build -trimpath -o dist $(hack/go-list-local-mods) +test -n "$VERSION" || VERSION=$(git describe --dirty --tags) +CGO_ENABLED=1 go build -trimpath -o dist -ldflags "-X main.version=$VERSION" $(hack/go-list-local-mods)