Add setting and getting version information

- Add `Version` string var to config package for storing version information.
- Update Makefile to set the `Version` variable at build time using the latest Git tag.
- Add `-version` flag to main package to print version information and exit.
- Remove setting the GO111MODULE environment variable from Makefile when building. It's not needed.
This commit is contained in:
Ryan Smith
2025-03-22 08:56:10 -07:00
parent f6cd4c783e
commit 7dc7b1ee83
3 changed files with 36 additions and 24 deletions

View File

@@ -12,6 +12,11 @@ import (
"github.com/r-smith/deceptifeed/internal/logrotate"
)
// Version stores Deceptifeed's version number. This variable is set at build
// time using the `-X` option with `-ldflags` and is assigned the latest Git
// tag. Refer to the Makefile in the project root for details on how it's set.
var Version = "undefined"
// This block of constants defines the default application settings when no
// configuration file is provided.
const (