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:
commit
33f807d9a1
6
Makefile
6
Makefile
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue