Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ GOPATH = $(shell go env GOPATH)
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GIT_TAG ?= $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`)
GIT_DATE=`TZ=UTC git show -s --date=iso-strict-local --format=%cd HEAD`
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%S%:z"`

PACKAGE = github.com/ethereum/go-ethereum
GO_FLAGS += -buildvcs=false
GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"
GO_LDFLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG} -X ${PACKAGE}/params.GitDate=${GIT_DATE} -X ${PACKAGE}/params.BuildDate=${BUILD_DATE}"
Comment thread
temaniarpit27 marked this conversation as resolved.
Outdated

TESTALL = $$(go list ./... | grep -v go-ethereum/cmd/)
TESTE2E = ./tests/...
GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) -p 1
GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) $(GO_LDFLAGS) -p 1

bor:
mkdir -p $(GOPATH)/bin/
go build -o $(GOBIN)/bor ./cmd/cli/main.go
go build -o $(GOBIN)/bor $(GO_LDFLAGS) ./cmd/cli/main.go
cp $(GOBIN)/bor $(GOPATH)/bin/
@echo "Done building."

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *VersionCommand) Synopsis() string {

// Run implements the cli.Command interface
func (c *VersionCommand) Run(args []string) int {
c.UI.Output(params.VersionWithMeta)
c.UI.Output(params.VersionWithMetaCommitDetails)

return 0
}
17 changes: 17 additions & 0 deletions params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const (
VersionMeta = "stable" // Version metadata to append to the version string
)

var (
GitCommit = ""
GitBranch = ""
GitDate = ""
BuildDate = ""
)

// Version holds the textual version string.
var Version = func() string {
return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
Expand All @@ -41,6 +48,16 @@ var VersionWithMeta = func() string {
return v
}()

// VersionWithCommitDetails holds the textual version string including the metadata and Git Details.
var VersionWithMetaCommitDetails = func() string {
v := Version
if VersionMeta != "" {
v += "-" + VersionMeta
}
v_git := fmt.Sprintf("Version : %s\nGitCommit : %s\nGitBranch : %s\nCommitDate : %s\nBuildDate : %s\n", v, GitCommit, GitBranch, GitDate, BuildDate)
return v_git
}()

// ArchiveVersion holds the textual version string used for Geth archives.
// e.g. "1.8.11-dea1ce05" for stable releases, or
//
Expand Down