mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
Print the revision, if known, separately from the version.
Also, indicate whether the build is dynamic or not.
This commit is contained in:
@@ -466,10 +466,15 @@ func (c *ServerCommand) Run(args []string) int {
|
||||
|
||||
infoKeys = append(infoKeys, "version")
|
||||
verInfo := version.GetVersion()
|
||||
info["version"] = verInfo.FullVersionNumber()
|
||||
info["version"] = verInfo.FullVersionNumber(false)
|
||||
if verInfo.Revision != "" {
|
||||
info["version_sha"] = strings.Trim(verInfo.Revision, "'")
|
||||
infoKeys = append(infoKeys, "version_sha")
|
||||
info["version sha"] = strings.Trim(verInfo.Revision, "'")
|
||||
infoKeys = append(infoKeys, "version sha")
|
||||
}
|
||||
infoKeys = append(infoKeys, "cgo")
|
||||
info["cgo"] = "disabled"
|
||||
if version.CgoEnabled {
|
||||
info["cgo"] = "enabled"
|
||||
}
|
||||
|
||||
// Server configuration output
|
||||
|
||||
@@ -16,7 +16,7 @@ func (c *VersionCommand) Help() string {
|
||||
}
|
||||
|
||||
func (c *VersionCommand) Run(_ []string) int {
|
||||
c.Ui.Output(c.VersionInfo.FullVersionNumber())
|
||||
c.Ui.Output(c.VersionInfo.FullVersionNumber(true))
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
7
version/cgo.go
Normal file
7
version/cgo.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// +build cgo
|
||||
|
||||
package version
|
||||
|
||||
func init() {
|
||||
CgoEnabled = true
|
||||
}
|
||||
@@ -10,6 +10,9 @@ var (
|
||||
GitCommit string
|
||||
GitDescribe string
|
||||
|
||||
// Whether cgo is enabled or not; set at build time
|
||||
CgoEnabled bool
|
||||
|
||||
Version = "unknown"
|
||||
VersionPrerelease = "unknown"
|
||||
)
|
||||
@@ -52,7 +55,7 @@ func (c *VersionInfo) VersionNumber() string {
|
||||
return version
|
||||
}
|
||||
|
||||
func (c *VersionInfo) FullVersionNumber() string {
|
||||
func (c *VersionInfo) FullVersionNumber(rev bool) string {
|
||||
var versionString bytes.Buffer
|
||||
|
||||
if Version == "unknown" && VersionPrerelease == "unknown" {
|
||||
@@ -62,10 +65,9 @@ func (c *VersionInfo) FullVersionNumber() string {
|
||||
fmt.Fprintf(&versionString, "Vault v%s", c.Version)
|
||||
if c.VersionPrerelease != "" {
|
||||
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)
|
||||
|
||||
if c.Revision != "" {
|
||||
fmt.Fprintf(&versionString, " (%s)", c.Revision)
|
||||
}
|
||||
}
|
||||
if rev && c.Revision != "" {
|
||||
fmt.Fprintf(&versionString, " (%s)", c.Revision)
|
||||
}
|
||||
|
||||
return versionString.String()
|
||||
|
||||
Reference in New Issue
Block a user