Version: stamp v1.28.2/masyunis
The Makefile build and prebaked-build targets now stamp Version=v$(VERSION)/masyunis via -ldflags. anubis.go keeps a link-time stamp instead of overwriting it with the VCS/module version from debug.ReadBuildInfo, and appends /masyunis when it does fall back to the module version. go run/go test still see 'devel'.
This commit is contained in:
1 parent
d19efd2dd2
commit
20021cb14f
2 files changed
+20
-7
No files matched your search
@@ -7,6 +7,12 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// masyunis: a version stamped at link time (see the Makefile, which sets
|
||||
// it to v$(VERSION)/masyunis) takes precedence over the module version.
|
||||
if Version != "devel" {
|
||||
return
|
||||
}
|
||||
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return
|
||||
@@ -14,14 +20,19 @@ func init() {
|
||||
|
||||
// XXX(Xe): many things in this repo assume that the development version
|
||||
// of anubis is `devel` and ReadBuildInfo returns `(devel)`. Shim the gap.
|
||||
if bi.Main.Version != "(devel)" {
|
||||
Version = bi.Main.Version
|
||||
if bi.Main.Version != "(devel)" && bi.Main.Version != "" {
|
||||
Version = bi.Main.Version + ForkSuffix
|
||||
}
|
||||
}
|
||||
|
||||
// ForkSuffix marks builds of the Masyunis fork in the displayed version.
|
||||
const ForkSuffix = "/masyunis"
|
||||
|
||||
// Version is the current version of Anubis.
|
||||
//
|
||||
// This is set from the Go module runtime version.
|
||||
// This is set from the Go module runtime version, or at link time with
|
||||
// -ldflags "-X 'github.com/TecharoHQ/anubis.Version=...'". It stays "devel"
|
||||
// for go run / go test so development-only behaviour keeps working.
|
||||
var Version = "devel"
|
||||
|
||||
// CookieName is the name of the cookie that Anubis uses in order to validate
|
||||
|
||||
Reference in new issue
Block a user