Merge PR #3620: Indicate build flags in version

This commit is contained in:
Juan Leni
2019-02-13 09:53:16 -08:00
committed by Jack Zampolin
parent c9a1c8a0db
commit 787f46546d
4 changed files with 38 additions and 9 deletions
+9 -3
View File
@@ -11,12 +11,14 @@ var (
Commit = ""
Version = ""
VendorDirHash = ""
BuildTags = ""
)
type versionInfo struct {
CosmosSDK string `json:"cosmos_sdk"`
GitCommit string `json:"commit"`
VendorDirHash string `json:"vendor_hash"`
BuildTags string `json:"build_tags"`
GoVersion string `json:"go"`
}
@@ -24,11 +26,15 @@ func (v versionInfo) String() string {
return fmt.Sprintf(`cosmos-sdk: %s
git commit: %s
vendor hash: %s
%s`, v.CosmosSDK, v.GitCommit, v.VendorDirHash, v.GoVersion)
build tags: %s
%s`, v.CosmosSDK, v.GitCommit, v.VendorDirHash, v.BuildTags, v.GoVersion)
}
func newVersionInfo() versionInfo {
return versionInfo{
Version, Commit, VendorDirHash, fmt.Sprintf("go version %s %s/%s\n",
runtime.Version(), runtime.GOOS, runtime.GOARCH)}
Version,
Commit,
VendorDirHash,
BuildTags,
fmt.Sprintf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)}
}