aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/build.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/build/build.go b/build/build.go
new file mode 100644
index 0000000..de6af5d
--- /dev/null
+++ b/build/build.go
@@ -0,0 +1,17 @@
+package build
+
+import "runtime/debug"
+
+// Version is dynamically set during build by the toolchain or overridden in the Makefile.
+var Version = "dev"
+
+// Date is dynamically set during build time in the Makefile.
+var Date = "unknown"
+
+func init() {
+ if Version == "dev" {
+ if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "(devel)" {
+ Version = info.Main.Version
+ }
+ }
+}