maddy/cmd/maddyctl/version.go
fox.cpp f9cd1e1c9a
cmd/maddy, cmd/maddyctl: Make Version a variable
Constants can't be modified by linker flags.
2019-10-20 16:56:01 +03:00

18 lines
315 B
Go

package main
import (
"fmt"
"runtime/debug"
)
var Version = "unknown (built from source tree)"
func buildInfo() string {
if info, ok := debug.ReadBuildInfo(); ok {
if info.Main.Version == "(devel)" {
return Version
}
return fmt.Sprintf("%s %s", info.Main.Version, info.Main.Sum)
}
return Version
}