chore: fix linter nits
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
May 10, 2019 at 23:53 UTC
4924b80e1007ba8a39d02df7bc6a1b914a367185
8 files changed
+13
-12
cmd/ipfs/util/ulimit_test.go
+1
-1
@@ -42,7 +42,7 @@ func TestManageInvalidNFds(t *testing.T) {
42
43
if changed, new, err := ManageFdLimit(); err == nil {
44
t.Errorf("ManageFdLimit should return an error: changed %t, new: %d", changed, new)
45
- } else if err != nil {
45
+ } else {
46
flag := strings.Contains(err.Error(),
47
"failed to raise ulimit to IPFS_FD_MAX")
48
if !flag {
core/builder.go
+4
-1
@@ -31,7 +31,10 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
31
// Note that some services use contexts to signal shutting down, which is
32
// very suboptimal. This needs to be here until that's addressed somehow
33
<-ctx.Done()
34
- app.Stop(context.Background())
34
+ err := app.Stop(context.Background())
35
+ if err != nil {
36
+ log.Error("failure on stop: ", err)
37
+ }
38
}()
39
40
n.IsOnline = cfg.Online
core/commands/block.go
+3
@@ -224,6 +224,9 @@ It takes a list of base58 encoded multihashes to remove.
224
// TODO: use batching coreapi when done
225
for _, b := range req.Arguments {
226
rp, err := api.ResolvePath(req.Context, path.New(b))
227
+ if err != nil {
228
+ return err
229
+ }
230
231
err = api.Block().Rm(req.Context, rp, options.Block.Force(force))
232
if err != nil {
core/corehttp/commands.go
+2
-4
@@ -61,10 +61,8 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
61
if acam := nc.API.HTTPHeaders[cmdsHttp.ACAMethods]; acam != nil {
62
c.SetAllowedMethods(acam...)
63
}
64
- if acac := nc.API.HTTPHeaders[cmdsHttp.ACACredentials]; acac != nil {
65
- for _, v := range acac {
66
- c.SetAllowCredentials(strings.ToLower(v) == "true")
67
- }
64
+ for _, v := range nc.API.HTTPHeaders[cmdsHttp.ACACredentials] {
65
+ c.SetAllowCredentials(strings.ToLower(v) == "true")
66
}
67
68
c.Headers = make(map[string][]string, len(nc.API.HTTPHeaders)+1)
core/coreunix/add_test.go
+1
-1
@@ -68,7 +68,7 @@ func TestAddMultipleGCLive(t *testing.T) {
68
69
go func() {
70
defer close(out)
71
- adder.AddAllAndPin(slf)
71
+ _, _ = adder.AddAllAndPin(slf)
72
// Ignore errors for clarity - the real bug would be gc'ing files while adding them, not this resultant error
73
}()
74
core/node/builder.go
-3
@@ -15,13 +15,10 @@ import (
15
ds "github.com/ipfs/go-datastore"
16
dsync "github.com/ipfs/go-datastore/sync"
17
cfg "github.com/ipfs/go-ipfs-config"
18
- logging "github.com/ipfs/go-log"
18
ci "github.com/libp2p/go-libp2p-crypto"
19
peer "github.com/libp2p/go-libp2p-peer"
20
)
21
23
-var log = logging.Logger("node")
24
-
22
type BuildCfg struct {
23
// If online is set, the node will have networking enabled
24
Online bool
core/node/storage.go
+1
-1
@@ -91,7 +91,7 @@ func GcBlockstoreCtor(bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockst
91
92
// GcBlockstoreCtor wraps GcBlockstore and adds Filestore support
93
func FilestoreBlockstoreCtor(repo repo.Repo, bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore, fstore *filestore.Filestore) {
94
- gclocker, gcbs, bs = GcBlockstoreCtor(bb)
94
+ gclocker = blockstore.NewGCLocker()
95
96
// hash security
97
fstore = filestore.NewFilestore(bb, repo.FileManager())
filestore/fsrefstore.go
+1
-1
@@ -281,7 +281,7 @@ func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error {
281
if !f.AllowFiles {
282
return ErrFilestoreNotEnabled
283
}
284
- if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) {
284
+ if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) { //nolint:staticcheck
285
return fmt.Errorf("cannot add filestore references outside ipfs root (%s)", f.root)
286
}
287