Skip to content

Commit

Permalink
Simplify version handling, rely on git describe #1941
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Treglia committed Sep 19, 2018
1 parent c6a3928 commit 13c67be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
COMMIT_HASH := $(shell git rev-parse --short HEAD)
VERSION := $(shell git describe --tags --long | sed 's/v\(.*\)/\1/')
BUILD_TAGS = netgo ledger
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}"
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}"
GCC := $(shell command -v gcc 2> /dev/null)
LEDGER_ENABLED ?= true
UNAME_S := $(shell uname -s)
Expand Down
10 changes: 0 additions & 10 deletions client/lcd/lcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,9 @@ func TestVersion(t *testing.T) {
res, body := Request(t, port, "GET", "/version", nil)
require.Equal(t, http.StatusOK, res.StatusCode, body)

reg, err := regexp.Compile(`\d+\.\d+\.\d+(-dev)?`)
require.Nil(t, err)
match := reg.MatchString(body)
require.True(t, match, body)

// node info
res, body = Request(t, port, "GET", "/node_version", nil)
require.Equal(t, http.StatusOK, res.StatusCode, body)

reg, err = regexp.Compile(`\d+\.\d+\.\d+(-dev)?`)
require.Nil(t, err)
match = reg.MatchString(body)
require.True(t, match, body)
}

func TestNodeStatus(t *testing.T) {
Expand Down
9 changes: 2 additions & 7 deletions version/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ var (

// return version of CLI/node and commit hash
func GetVersion() string {
v := Version
if GitCommit != "" {
v = v + "-" + GitCommit
}
return v
return Version
}

// CMD
func printVersion(cmd *cobra.Command, args []string) {
v := GetVersion()
fmt.Println(v)
fmt.Println(GetVersion())
}
8 changes: 1 addition & 7 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
//nolint
package version

const Maj = "0"
const Min = "24"
const Fix = "2"

const Version = "0.24.2"

// GitCommit set by build flags
var GitCommit = ""
var Version = ""

0 comments on commit 13c67be

Please sign in to comment.