Merge pull request #489 from tendermint/feature/adrian-#469

Use ld flags to set git hash instead of "revision_file"
This commit is contained in:
Ethan Buchman 2017-05-14 21:52:29 +02:00 committed by GitHub
commit 33f807d9a1
2 changed files with 23 additions and 3 deletions

View File

@ -8,10 +8,12 @@ TMHOME = $${TMHOME:-$$HOME/.tendermint}
all: install test
install: get_vendor_deps
@go install ./cmd/tendermint
@go install --ldflags '-extldflags "-static"' \
--ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" ./cmd/tendermint
build:
go build -o build/tendermint ./cmd/tendermint
go build \
--ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" -o build/tendermint ./cmd/tendermint/
build_race:
go build -race -o build/tendermint ./cmd/tendermint

View File

@ -1,7 +1,25 @@
package version
import (
"fmt"
)
const Maj = "0"
const Min = "10"
const Fix = "0"
const Version = "0.10.0"
var (
// The full version string
Version = "0.10.0"
// GitCommit is set with --ldflags "-X main.gitCommit=$(git rev-parse HEAD)"
GitCommit string
)
func init() {
Version = fmt.Sprintf("%d.%d.%d", Maj, Min, Fix)
if GitCommit != "" {
Version += "-" + GitCommit[:8]
}
}