From 581feffe944a5eeb42f4cba3e4d24f0e1d5b0b3f Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 30 Apr 2024 20:50:31 +0200 Subject: Add source version to executable The output of `git describe --dirty --always` is passed as a string via Go build flags. --- version.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 version.go (limited to 'version.go') diff --git a/version.go b/version.go new file mode 100644 index 0000000..c3cc266 --- /dev/null +++ b/version.go @@ -0,0 +1,13 @@ +package main + +import "fmt" + +var gitDescribe string + +func version() (string, error) { + if gitDescribe == "" { + return "", fmt.Errorf("No version information available") + } + + return gitDescribe, nil +} -- cgit v1.2.3-70-g09d2