From e247dcc141a5d1c9129b987a5f164e9df29be951 Mon Sep 17 00:00:00 2001 From: gluk256 Date: Thu, 24 Jan 2019 15:35:10 +0400 Subject: swarm/version: commit version added (#18510) (cherry picked from commit ad13d2d407d2f614c39af92430fda0a926da2a8a) --- cmd/swarm/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cmd/swarm') diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index 722dc4ff5..53888b615 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -66,9 +66,10 @@ OPTIONS: {{end}}{{end}} ` -var ( - gitCommit string // Git SHA1 commit hash of the release (set via linker flags) -) +// Git SHA1 commit hash of the release (set via linker flags) +// this variable will be assigned if corresponding parameter is passed with install, but not with test +// e.g.: go install -ldflags "-X main.gitCommit=ed1312d01b19e04ef578946226e5d8069d5dfd5a" ./cmd/swarm +var gitCommit string //declare a few constant error messages, useful for later error check comparisons in test var ( @@ -89,6 +90,7 @@ var defaultNodeConfig = node.DefaultConfig // This init function sets defaults so cmd/swarm can run alongside geth. func init() { + sv.GitCommit = gitCommit defaultNodeConfig.Name = clientIdentifier defaultNodeConfig.Version = sv.VersionWithCommit(gitCommit) defaultNodeConfig.P2P.ListenAddr = ":30399" -- cgit