After building the latest source, the binary reports:
$ amneziawg-go --version
amneziawg-go 0.0.20250522
This does not match the current project release, which currently hardcoded in the:
|
const Version = "0.0.20250522" |
Instead of using a constant, would it make sense to use a variable and inject the version during the build process using Go linker ldflags?
For example:
package main
var Version = "dev"
Then the release build could set the version dynamically:
go build -ldflags "-X main.Version=3.0.3"
This would ensure that release binaries always report the correct version and eliminate the need to manually update version.go for every release.
After building the latest source, the binary reports:
This does not match the current project release, which currently hardcoded in the:
amneziawg-go/version.go
Line 3 in cf9d2dd
Instead of using a constant, would it make sense to use a variable and inject the version during the build process using Go linker ldflags?
For example:
Then the release build could set the version dynamically:
go build -ldflags "-X main.Version=3.0.3"This would ensure that release binaries always report the correct version and eliminate the need to manually update
version.gofor every release.