Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
f6f8d685
Commit
f6f8d685
authored
Aug 27, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version: don't print 'VERSION-' if no commit is specified
fixes #6022
parent
32d54a0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+5
-1
core/commands/version.go
core/commands/version.go
+12
-8
core/core.go
core/core.go
+2
-1
No files found.
cmd/ipfs/daemon.go
View file @
f6f8d685
...
...
@@ -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
())
...
...
core/commands/version.go
View file @
f6f8d685
...
...
@@ -54,21 +54,25 @@ var VersionCmd = &cmds.Command{
},
Encoders
:
cmds
.
EncoderMap
{
cmds
.
Text
:
cmds
.
MakeTypedEncoder
(
func
(
req
*
cmds
.
Request
,
w
io
.
Writer
,
version
*
VersionOutput
)
error
{
commit
,
_
:=
req
.
Options
[
versionCommitOptionName
]
.
(
bool
)
commitTxt
:=
""
if
commit
{
commitTxt
=
"-"
+
version
.
Commit
}
all
,
_
:=
req
.
Options
[
versionAllOptionName
]
.
(
bool
)
if
all
{
out
:=
fmt
.
Sprintf
(
"go-ipfs version: %s-%s
\n
"
+
ver
:=
version
.
Version
if
version
.
Commit
!=
""
{
ver
+=
"-"
+
version
.
Commit
}
out
:=
fmt
.
Sprintf
(
"go-ipfs version: %s
\n
"
+
"Repo version: %s
\n
System version: %s
\n
Golang version: %s
\n
"
,
ver
sion
.
Version
,
version
.
Commit
,
version
.
Repo
,
version
.
System
,
version
.
Golang
)
ver
,
version
.
Repo
,
version
.
System
,
version
.
Golang
)
fmt
.
Fprint
(
w
,
out
)
return
nil
}
commit
,
_
:=
req
.
Options
[
versionCommitOptionName
]
.
(
bool
)
commitTxt
:=
""
if
commit
&&
version
.
Commit
!=
""
{
commitTxt
=
"-"
+
version
.
Commit
}
repo
,
_
:=
req
.
Options
[
versionRepoOptionName
]
.
(
bool
)
if
repo
{
fmt
.
Fprintln
(
w
,
version
.
Repo
)
...
...
core/core.go
View file @
f6f8d685
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment