summaryrefslogtreecommitdiff
path: root/version.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-04-30 20:50:31 +0200
committerxengineering <me@xengineering.eu>2024-04-30 20:50:31 +0200
commit581feffe944a5eeb42f4cba3e4d24f0e1d5b0b3f (patch)
tree65abe9db24d27e9904d2f1c4833e613550c3d8c2 /version.go
parentdd6870ba93242d528cff2c4019934ddb8782c9db (diff)
downloadceres-581feffe944a5eeb42f4cba3e4d24f0e1d5b0b3f.tar
ceres-581feffe944a5eeb42f4cba3e4d24f0e1d5b0b3f.tar.zst
ceres-581feffe944a5eeb42f4cba3e4d24f0e1d5b0b3f.zip
Add source version to executable
The output of `git describe --dirty --always` is passed as a string via Go build flags.
Diffstat (limited to 'version.go')
-rw-r--r--version.go13
1 files changed, 13 insertions, 0 deletions
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
+}