cmd: add a 'version' subcommand and flag to show the version
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user