Skip to content

Commit

Permalink
Add : commit details to bor version (ethereum#730)
Browse files Browse the repository at this point in the history
* add : commit details to bor version

* fix : MAKEFILE

* undo : rm test-txpool-race

* rm : params/build_date

* rm : params/gitbranch and params/gitdate
  • Loading branch information
0xsharma authored Feb 14, 2023
1 parent 6f153f0 commit ec14a06
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ GORUN = env GO111MODULE=on go run
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`)

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} "

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
}
14 changes: 14 additions & 0 deletions params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const (
VersionMeta = "stable" // Version metadata to append to the version string
)

var (
GitCommit = ""
)

// Version holds the textual version string.
var Version = func() string {
return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
Expand All @@ -41,6 +45,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\n", v, GitCommit)
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

0 comments on commit ec14a06

Please sign in to comment.