diff options
| author | Priyansh <[email protected]> | 2025-08-27 14:56:58 +0530 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2025-08-27 14:56:58 +0530 |
| commit | 590812232f19a4276856b23ff1aa5a8b11522fbc (patch) | |
| tree | 741b130c8347430d2c03e7ae6b5dd17f29d7426a | |
| parent | 7e779464a09a78544ec4c59c59581718e90cb1e2 (diff) | |
| download | nectar-590812232f19a4276856b23ff1aa5a8b11522fbc.tar.xz nectar-590812232f19a4276856b23ff1aa5a8b11522fbc.zip | |
Add build package for version management
| -rw-r--r-- | build/build.go | 17 |
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 + } + } +} |
