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-unixfs
Commits
1291470b
Commit
1291470b
authored
Jan 15, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use core_io/Add in commands/init/writeWelcomeFile
parent
ffe6f9a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
10 deletions
+2
-10
cmd/ipfs/init.go
cmd/ipfs/init.go
+2
-10
No files found.
cmd/ipfs/init.go
View file @
1291470b
...
...
@@ -10,8 +10,7 @@ import (
cmds
"github.com/jbenet/go-ipfs/commands"
core
"github.com/jbenet/go-ipfs/core"
corecmds
"github.com/jbenet/go-ipfs/core/commands"
imp
"github.com/jbenet/go-ipfs/importer"
chunk
"github.com/jbenet/go-ipfs/importer/chunk"
core_io
"github.com/jbenet/go-ipfs/core/io"
ci
"github.com/jbenet/go-ipfs/p2p/crypto"
peer
"github.com/jbenet/go-ipfs/p2p/peer"
repo
"github.com/jbenet/go-ipfs/repo"
...
...
@@ -117,7 +116,6 @@ func doInit(repoRoot string, force bool, nBitsForKeypair int) (interface{}, erro
// addTheWelcomeFile adds a file containing the welcome message to the newly
// minted node. On success, it calls onSuccess
func
addTheWelcomeFile
(
repoRoot
string
)
error
{
// TODO extract this file creation operation into a function
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
r
:=
fsrepo
.
At
(
repoRoot
)
...
...
@@ -132,13 +130,7 @@ func addTheWelcomeFile(repoRoot string) error {
// Set up default file
reader
:=
bytes
.
NewBufferString
(
welcomeMsg
)
defnd
,
err
:=
imp
.
BuildDagFromReader
(
reader
,
nd
.
DAG
,
nd
.
Pinning
.
GetManual
(),
chunk
.
DefaultSplitter
)
if
err
!=
nil
{
return
err
}
k
,
err
:=
defnd
.
Key
()
k
,
err
:=
core_io
.
Add
(
nd
,
reader
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to write test file: %s"
,
err
)
}
...
...
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