cmd: add a 'version' subcommand and flag to show the version
Some checks failed
CI / build-docker (push) Successful in 4s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Failing after 13s

This commit is contained in:
2026-09-19 21:36:31 -07:00
parent 741709623b
commit 171da4139b
4 changed files with 88 additions and 1 deletions

View File

@@ -1,3 +1,10 @@
#!/bin/sh
go build -tags fts5 -o gas ./cmd
# Stamp the version into the binary. `git describe` fails when this isn't a git checkout (e.g. a
# source export with no .git dir); in that case leave it empty, and pkg/version falls back to the
# build info that the Go toolchain embeds.
VERSION=$(git describe --tags --always --dirty 2>/dev/null)
go build -tags fts5 \
-ldflags "-X git.offline-twitter.com/offline-labs/gas-stack/pkg/version.Version=$VERSION" \
-o gas ./cmd