Remove errors pointed out by govet
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Jun 14, 2016 at 13:32 UTC
a2cd3ebca0548523791cbe743fc6abdebd36cb9c
9 files changed
+9
-12
cmd/ipfs/daemon.go
+1
-1
@@ -169,7 +169,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
169
managefd, _, _ := req.Option(adjustFDLimitKwd).Bool()
170
if managefd {
171
if err := fileDescriptorCheck(); err != nil {
172
- log.Error("setting file descriptor limit: %s", err)
172
+ log.Errorf("setting file descriptor limit: %s", err)
173
}
174
}
175
cmd/ipfs/ulimit_unix.go
+1
-1
@@ -15,7 +15,7 @@ func init() {
15
if val := os.Getenv("IPFS_FD_MAX"); val != "" {
16
n, err := strconv.Atoi(val)
17
if err != nil {
18
- log.Error("bad value for IPFS_FD_MAX: %s", err)
18
+ log.Errorf("bad value for IPFS_FD_MAX: %s", err)
19
} else {
20
ipfsFileDescNum = uint64(n)
21
}
commands/files/file_test.go
+1
-1
@@ -175,7 +175,7 @@ anotherfile
175
t.Fatalf("expected to be able to read 12 bytes from file: %s (got %d)", err, n)
176
}
177
if err := mpf.Close(); err != nil {
178
- t.Fatal("should be able to close file: %s", err)
178
+ t.Fatalf("should be able to close file: %s", err)
179
}
180
181
// test properties of symlink created from fourth part (symlink)
merkledag/merkledag_test.go
+1
-1
@@ -131,7 +131,7 @@ func SubtestNodeStat(t *testing.T, n *Node) {
131
}
132
133
if expected != *actual {
134
- t.Error("n.Stat incorrect.\nexpect: %s\nactual: %s", expected, actual)
134
+ t.Errorf("n.Stat incorrect.\nexpect: %s\nactual: %s", expected, actual)
135
} else {
136
fmt.Printf("n.Stat correct: %s\n", actual)
137
}
mfs/ops.go
+1
-1
@@ -162,7 +162,7 @@ func Mkdir(r *Root, pth string, mkparents bool, flush bool) error {
162
func Lookup(r *Root, path string) (FSNode, error) {
163
dir, ok := r.GetValue().(*Directory)
164
if !ok {
165
- log.Error("root not a dir: %#v", r.GetValue())
165
+ log.Errorf("root not a dir: %#v", r.GetValue())
166
return nil, errors.New("root was not a directory")
167
}
168
mfs/system.go
+1
-1
@@ -265,7 +265,7 @@ func (np *Republisher) Run() {
265
pubnowresp <- struct{}{}
266
}
267
if err != nil {
268
- log.Error("republishRoot error: %s", err)
268
+ log.Errorf("republishRoot error: %s", err)
269
}
270
271
case <-np.ctx.Done():
routing/dht/dht_net.go
-2
@@ -64,8 +64,6 @@ func (dht *IpfsDHT) handleNewMessage(s inet.Stream) {
64
return
65
}
66
}
67
-
68
- return
67
}
68
69
// sendRequest sends out a request, but also makes sure to
routing/dht/dht_test.go
+3
-3
@@ -214,7 +214,7 @@ func TestProvides(t *testing.T) {
214
t.Fatal(err)
215
}
216
if !bytes.Equal(bits.GetValue(), v) {
217
- t.Fatal("didn't store the right bits (%s, %s)", k, v)
217
+ t.Fatalf("didn't store the right bits (%s, %s)", k, v)
218
}
219
}
220
@@ -289,7 +289,7 @@ func waitForWellFormedTables(t *testing.T, dhts []*IpfsDHT, minPeers, avgPeers i
289
290
func printRoutingTables(dhts []*IpfsDHT) {
291
// the routing tables should be full now. let's inspect them.
292
- fmt.Println("checking routing table of %d", len(dhts))
292
+ fmt.Printf("checking routing table of %d\n", len(dhts))
293
for _, dht := range dhts {
294
fmt.Printf("checking routing table of %s\n", dht.self)
295
dht.routingTable.Print()
@@ -487,7 +487,7 @@ func TestProvidesMany(t *testing.T) {
487
t.Fatal(err)
488
}
489
if !bytes.Equal(bits.GetValue(), v) {
490
- t.Fatal("didn't store the right bits (%s, %s)", k, v)
490
+ t.Fatalf("didn't store the right bits (%s, %s)", k, v)
491
}
492
493
t.Logf("announcing provider for %s", k)
unixfs/io/dagreader.go
-1
@@ -279,7 +279,6 @@ func (dr *DagReader) Seek(offset int64, whence int) (int64, error) {
279
default:
280
return 0, errors.New("invalid whence")
281
}
282
- return 0, nil
282
}
283
284
// readSeekNopCloser wraps a bytes.Reader to implement ReadSeekCloser