Merge PR #3620: Indicate build flags in version
This commit is contained in:
parent
c9a1c8a0db
commit
787f46546d
9
Makefile
9
Makefile
|
@ -4,10 +4,11 @@ VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
|||
COMMIT := $(shell git log -1 --format='%H')
|
||||
BUILD_TAGS = netgo
|
||||
CAT := $(if $(filter $(OS),Windows_NT),type,cat)
|
||||
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags \
|
||||
"-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
|
||||
-X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
|
||||
-X github.com/cosmos/cosmos-sdk/version.VendorDirHash=$(shell $(CAT) vendor-deps)"
|
||||
BUILD_FLAGS = -tags "$(BUILD_TAGS)" -ldflags \
|
||||
'-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
|
||||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
|
||||
-X github.com/cosmos/cosmos-sdk/version.VendorDirHash=$(shell $(CAT) vendor-deps) \
|
||||
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(BUILD_TAGS)"'
|
||||
LEDGER_ENABLED ?= true
|
||||
GOTOOLS = \
|
||||
github.com/golang/dep/cmd/dep \
|
||||
|
|
|
@ -34,6 +34,9 @@ IMPROVEMENTS
|
|||
* Gaia
|
||||
|
||||
* SDK
|
||||
* [\#3604] Improve SDK funds related error messages and allow for unicode in
|
||||
JSON ABCI log.
|
||||
* [\#3620](https://github.com/cosmos/cosmos-sdk/pull/3620) Version command shows build tags
|
||||
|
||||
* \#3638 Add Bcrypt benchmarks & justification of security parameter choice
|
||||
|
||||
|
|
|
@ -36,10 +36,29 @@ make tools install
|
|||
That will install the `gaiad` and `gaiacli` binaries. Verify that everything is OK:
|
||||
|
||||
```bash
|
||||
$ gaiad version
|
||||
$ gaiacli version
|
||||
$ gaiad version --long
|
||||
$ gaiacli version --long
|
||||
```
|
||||
|
||||
`gaiacli` for instance should output something similar to:
|
||||
|
||||
```
|
||||
cosmos-sdk: 0.31.2-10-g1fba7308
|
||||
git commit: 1fba7308fa226e971964cd6baad9527d4b51d9fc
|
||||
vendor hash: 1aec7edfad9888a967b3e9063e42f66b28f447e6
|
||||
build tags: netgo ledger
|
||||
go version go1.11.5 linux/amd64
|
||||
```
|
||||
|
||||
##### Build Tags
|
||||
|
||||
Build tags indicate special features that have been enabled in the binary.
|
||||
|
||||
| Build Tag | Description |
|
||||
| --------- | ----------------------------------------------- |
|
||||
| netgo | Name resolution will use pure Go code |
|
||||
| ledger | Ledger devices are supported (hardware wallets) |
|
||||
|
||||
### Next
|
||||
|
||||
Now you can [join the public testnet](./join-testnet.md) or [create you own testnet](./deploy-testnet.md)
|
||||
|
|
|
@ -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)}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue