aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2025-08-27 14:56:58 +0530
committerPriyansh <[email protected]>2025-08-27 14:56:58 +0530
commit590812232f19a4276856b23ff1aa5a8b11522fbc (patch)
tree741b130c8347430d2c03e7ae6b5dd17f29d7426a /build
parent7e779464a09a78544ec4c59c59581718e90cb1e2 (diff)
downloadnectar-590812232f19a4276856b23ff1aa5a8b11522fbc.tar.xz
nectar-590812232f19a4276856b23ff1aa5a8b11522fbc.zip
Add build package for version management
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
+ }
+ }
+}