From a2cd3ebca0548523791cbe743fc6abdebd36cb9c Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 14 Jun 2016 13:32:48 +0200 Subject: [PATCH] Remove errors pointed out by govet License: MIT Signed-off-by: Jakub Sztandera --- cmd/ipfs/daemon.go | 2 +- cmd/ipfs/ulimit_unix.go | 2 +- commands/files/file_test.go | 2 +- merkledag/merkledag_test.go | 2 +- mfs/ops.go | 2 +- mfs/system.go | 2 +- routing/dht/dht_net.go | 2 -- routing/dht/dht_test.go | 6 +++--- unixfs/io/dagreader.go | 1 - 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 62a1b31c5cf..e6c6871da0a 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -169,7 +169,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { managefd, _, _ := req.Option(adjustFDLimitKwd).Bool() if managefd { if err := fileDescriptorCheck(); err != nil { - log.Error("setting file descriptor limit: %s", err) + log.Errorf("setting file descriptor limit: %s", err) } } diff --git a/cmd/ipfs/ulimit_unix.go b/cmd/ipfs/ulimit_unix.go index 1ad630f744e..f80ce902928 100644 --- a/cmd/ipfs/ulimit_unix.go +++ b/cmd/ipfs/ulimit_unix.go @@ -15,7 +15,7 @@ func init() { if val := os.Getenv("IPFS_FD_MAX"); val != "" { n, err := strconv.Atoi(val) if err != nil { - log.Error("bad value for IPFS_FD_MAX: %s", err) + log.Errorf("bad value for IPFS_FD_MAX: %s", err) } else { ipfsFileDescNum = uint64(n) } diff --git a/commands/files/file_test.go b/commands/files/file_test.go index 4eb2ce5647c..a5d60102f87 100644 --- a/commands/files/file_test.go +++ b/commands/files/file_test.go @@ -175,7 +175,7 @@ anotherfile t.Fatalf("expected to be able to read 12 bytes from file: %s (got %d)", err, n) } 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) diff --git a/merkledag/merkledag_test.go b/merkledag/merkledag_test.go index a84c9d4e492..644d4e2d5ee 100644 --- a/merkledag/merkledag_test.go +++ b/merkledag/merkledag_test.go @@ -131,7 +131,7 @@ func SubtestNodeStat(t *testing.T, n *Node) { } 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 { fmt.Printf("n.Stat correct: %s\n", actual) } diff --git a/mfs/ops.go b/mfs/ops.go index 950552f1b91..7cf9ed9f30a 100644 --- a/mfs/ops.go +++ b/mfs/ops.go @@ -162,7 +162,7 @@ func Mkdir(r *Root, pth string, mkparents bool, flush bool) error { func Lookup(r *Root, path string) (FSNode, error) { dir, ok := r.GetValue().(*Directory) 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") } diff --git a/mfs/system.go b/mfs/system.go index b97b1c59438..b0ee42e7366 100644 --- a/mfs/system.go +++ b/mfs/system.go @@ -265,7 +265,7 @@ func (np *Republisher) Run() { pubnowresp <- struct{}{} } if err != nil { - log.Error("republishRoot error: %s", err) + log.Errorf("republishRoot error: %s", err) } case <-np.ctx.Done(): diff --git a/routing/dht/dht_net.go b/routing/dht/dht_net.go index c7d2453410a..f67474760d0 100644 --- a/routing/dht/dht_net.go +++ b/routing/dht/dht_net.go @@ -64,8 +64,6 @@ func (dht *IpfsDHT) handleNewMessage(s inet.Stream) { return } } - - return } // sendRequest sends out a request, but also makes sure to diff --git a/routing/dht/dht_test.go b/routing/dht/dht_test.go index fcac1a7b7c4..b9eb5eb5a16 100644 --- a/routing/dht/dht_test.go +++ b/routing/dht/dht_test.go @@ -214,7 +214,7 @@ func TestProvides(t *testing.T) { t.Fatal(err) } 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) { // 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 { fmt.Printf("checking routing table of %s\n", dht.self) dht.routingTable.Print() @@ -487,7 +487,7 @@ func TestProvidesMany(t *testing.T) { t.Fatal(err) } 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) diff --git a/unixfs/io/dagreader.go b/unixfs/io/dagreader.go index 3c68ad896ba..b78b46269fb 100644 --- a/unixfs/io/dagreader.go +++ b/unixfs/io/dagreader.go @@ -279,7 +279,6 @@ func (dr *DagReader) Seek(offset int64, whence int) (int64, error) { default: return 0, errors.New("invalid whence") } - return 0, nil } // readSeekNopCloser wraps a bytes.Reader to implement ReadSeekCloser