1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 15:42:21 +08:00

Remove errors pointed out by govet

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera
2016-06-14 13:32:48 +02:00
parent 79e9bd842c
commit a2cd3ebca0
9 changed files with 9 additions and 12 deletions

View File

@ -169,7 +169,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
managefd, _, _ := req.Option(adjustFDLimitKwd).Bool() managefd, _, _ := req.Option(adjustFDLimitKwd).Bool()
if managefd { if managefd {
if err := fileDescriptorCheck(); err != nil { if err := fileDescriptorCheck(); err != nil {
log.Error("setting file descriptor limit: %s", err) log.Errorf("setting file descriptor limit: %s", err)
} }
} }

View File

@ -15,7 +15,7 @@ func init() {
if val := os.Getenv("IPFS_FD_MAX"); val != "" { if val := os.Getenv("IPFS_FD_MAX"); val != "" {
n, err := strconv.Atoi(val) n, err := strconv.Atoi(val)
if err != nil { if err != nil {
log.Error("bad value for IPFS_FD_MAX: %s", err) log.Errorf("bad value for IPFS_FD_MAX: %s", err)
} else { } else {
ipfsFileDescNum = uint64(n) ipfsFileDescNum = uint64(n)
} }

View File

@ -175,7 +175,7 @@ anotherfile
t.Fatalf("expected to be able to read 12 bytes from file: %s (got %d)", err, n) t.Fatalf("expected to be able to read 12 bytes from file: %s (got %d)", err, n)
} }
if err := mpf.Close(); err != nil { if err := mpf.Close(); err != nil {
t.Fatal("should be able to close file: %s", err) t.Fatalf("should be able to close file: %s", err)
} }
// test properties of symlink created from fourth part (symlink) // test properties of symlink created from fourth part (symlink)

View File

@ -131,7 +131,7 @@ func SubtestNodeStat(t *testing.T, n *Node) {
} }
if expected != *actual { if expected != *actual {
t.Error("n.Stat incorrect.\nexpect: %s\nactual: %s", expected, actual) t.Errorf("n.Stat incorrect.\nexpect: %s\nactual: %s", expected, actual)
} else { } else {
fmt.Printf("n.Stat correct: %s\n", actual) fmt.Printf("n.Stat correct: %s\n", actual)
} }

View File

@ -162,7 +162,7 @@ func Mkdir(r *Root, pth string, mkparents bool, flush bool) error {
func Lookup(r *Root, path string) (FSNode, error) { func Lookup(r *Root, path string) (FSNode, error) {
dir, ok := r.GetValue().(*Directory) dir, ok := r.GetValue().(*Directory)
if !ok { if !ok {
log.Error("root not a dir: %#v", r.GetValue()) log.Errorf("root not a dir: %#v", r.GetValue())
return nil, errors.New("root was not a directory") return nil, errors.New("root was not a directory")
} }

View File

@ -265,7 +265,7 @@ func (np *Republisher) Run() {
pubnowresp <- struct{}{} pubnowresp <- struct{}{}
} }
if err != nil { if err != nil {
log.Error("republishRoot error: %s", err) log.Errorf("republishRoot error: %s", err)
} }
case <-np.ctx.Done(): case <-np.ctx.Done():

View File

@ -64,8 +64,6 @@ func (dht *IpfsDHT) handleNewMessage(s inet.Stream) {
return return
} }
} }
return
} }
// sendRequest sends out a request, but also makes sure to // sendRequest sends out a request, but also makes sure to

View File

@ -214,7 +214,7 @@ func TestProvides(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if !bytes.Equal(bits.GetValue(), v) { if !bytes.Equal(bits.GetValue(), v) {
t.Fatal("didn't store the right bits (%s, %s)", k, v) t.Fatalf("didn't store the right bits (%s, %s)", k, v)
} }
} }
@ -289,7 +289,7 @@ func waitForWellFormedTables(t *testing.T, dhts []*IpfsDHT, minPeers, avgPeers i
func printRoutingTables(dhts []*IpfsDHT) { func printRoutingTables(dhts []*IpfsDHT) {
// the routing tables should be full now. let's inspect them. // the routing tables should be full now. let's inspect them.
fmt.Println("checking routing table of %d", len(dhts)) fmt.Printf("checking routing table of %d\n", len(dhts))
for _, dht := range dhts { for _, dht := range dhts {
fmt.Printf("checking routing table of %s\n", dht.self) fmt.Printf("checking routing table of %s\n", dht.self)
dht.routingTable.Print() dht.routingTable.Print()
@ -487,7 +487,7 @@ func TestProvidesMany(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if !bytes.Equal(bits.GetValue(), v) { if !bytes.Equal(bits.GetValue(), v) {
t.Fatal("didn't store the right bits (%s, %s)", k, v) t.Fatalf("didn't store the right bits (%s, %s)", k, v)
} }
t.Logf("announcing provider for %s", k) t.Logf("announcing provider for %s", k)

View File

@ -279,7 +279,6 @@ func (dr *DagReader) Seek(offset int64, whence int) (int64, error) {
default: default:
return 0, errors.New("invalid whence") return 0, errors.New("invalid whence")
} }
return 0, nil
} }
// readSeekNopCloser wraps a bytes.Reader to implement ReadSeekCloser // readSeekNopCloser wraps a bytes.Reader to implement ReadSeekCloser