From 955b8a554d15a35f4deafd8c9f44e868bccfe213 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 27 Aug 2019 23:31:08 -0700 Subject: [PATCH] version: don't print 'VERSION-' if no commit is specified fixes #6022 --- cmd/ipfs/daemon.go | 6 +++++- core/core.go | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index ec5a979e16dc..ed4cf4f46728 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -726,7 +726,11 @@ func YesNoPrompt(prompt string) bool { } func printVersion() { - fmt.Printf("go-ipfs version: %s-%s\n", version.CurrentVersionNumber, version.CurrentCommit) + v := version.CurrentVersionNumber + if version.CurrentCommit != "" { + v += "-" + version.CurrentCommit + } + fmt.Printf("go-ipfs version: %s\n", v) fmt.Printf("Repo version: %d\n", fsrepo.RepoVersion) fmt.Printf("System version: %s\n", runtime.GOARCH+"/"+runtime.GOOS) fmt.Printf("Golang version: %s\n", runtime.Version()) diff --git a/core/core.go b/core/core.go index 0f3b7083b667..0dba021e372f 100644 --- a/core/core.go +++ b/core/core.go @@ -12,6 +12,7 @@ package core import ( "context" "io" + "path" "github.com/ipfs/go-filestore" version "github.com/ipfs/go-ipfs" @@ -54,7 +55,7 @@ import ( var log = logging.Logger("core") func init() { - identify.ClientVersion = "go-ipfs/" + version.CurrentVersionNumber + "/" + version.CurrentCommit + identify.ClientVersion = path.Join("go-ipfs", version.CurrentVersionNumber, version.CurrentCommit) } // IpfsNode is IPFS Core module. It represents an IPFS instance.