Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace coreunix.Add with shell/fsnode's AddFromReader #1136

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
cmd/ipfs/init: bytes.NewBufferString -> strings.NewReader
From the docs for strings.NewReader [1]:

  It is similar to bytes.NewBufferString but more efficient and
  read-only.

[1]: https://golang.org/pkg/strings/#NewReader
wking committed May 4, 2015
commit 9deaa044bafa928c57e4ebf10698fd55b592c82a
6 changes: 3 additions & 3 deletions cmd/ipfs/init.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
"bytes"
"errors"
"fmt"
"io"
"strings"

context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
assets "github.com/ipfs/go-ipfs/assets"
@@ -137,9 +137,9 @@ func addDefaultAssets(out io.Writer, repoRoot string) error {

// add every file in the assets pkg
for fname, file := range assets.Init_dir {
buf := bytes.NewBufferString(file)
reader := strings.NewReader(file)
dagNode, err := importer.BuildDagFromReader(
buf,
reader,
nd.DAG,
nd.Pinning.GetManual(),
chunk.DefaultSplitter)