提交 4924b80e 作者: Steven Allen

chore: fix linter nits

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 96e6dd29
...@@ -42,7 +42,7 @@ func TestManageInvalidNFds(t *testing.T) { ...@@ -42,7 +42,7 @@ func TestManageInvalidNFds(t *testing.T) {
if changed, new, err := ManageFdLimit(); err == nil { if changed, new, err := ManageFdLimit(); err == nil {
t.Errorf("ManageFdLimit should return an error: changed %t, new: %d", changed, new) t.Errorf("ManageFdLimit should return an error: changed %t, new: %d", changed, new)
} else if err != nil { } else {
flag := strings.Contains(err.Error(), flag := strings.Contains(err.Error(),
"failed to raise ulimit to IPFS_FD_MAX") "failed to raise ulimit to IPFS_FD_MAX")
if !flag { if !flag {
......
...@@ -31,7 +31,10 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) { ...@@ -31,7 +31,10 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
// Note that some services use contexts to signal shutting down, which is // Note that some services use contexts to signal shutting down, which is
// very suboptimal. This needs to be here until that's addressed somehow // very suboptimal. This needs to be here until that's addressed somehow
<-ctx.Done() <-ctx.Done()
app.Stop(context.Background()) err := app.Stop(context.Background())
if err != nil {
log.Error("failure on stop: ", err)
}
}() }()
n.IsOnline = cfg.Online n.IsOnline = cfg.Online
......
...@@ -224,6 +224,9 @@ It takes a list of base58 encoded multihashes to remove. ...@@ -224,6 +224,9 @@ It takes a list of base58 encoded multihashes to remove.
// TODO: use batching coreapi when done // TODO: use batching coreapi when done
for _, b := range req.Arguments { for _, b := range req.Arguments {
rp, err := api.ResolvePath(req.Context, path.New(b)) rp, err := api.ResolvePath(req.Context, path.New(b))
if err != nil {
return err
}
err = api.Block().Rm(req.Context, rp, options.Block.Force(force)) err = api.Block().Rm(req.Context, rp, options.Block.Force(force))
if err != nil { if err != nil {
......
...@@ -61,10 +61,8 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) { ...@@ -61,10 +61,8 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
if acam := nc.API.HTTPHeaders[cmdsHttp.ACAMethods]; acam != nil { if acam := nc.API.HTTPHeaders[cmdsHttp.ACAMethods]; acam != nil {
c.SetAllowedMethods(acam...) c.SetAllowedMethods(acam...)
} }
if acac := nc.API.HTTPHeaders[cmdsHttp.ACACredentials]; acac != nil { for _, v := range nc.API.HTTPHeaders[cmdsHttp.ACACredentials] {
for _, v := range acac { c.SetAllowCredentials(strings.ToLower(v) == "true")
c.SetAllowCredentials(strings.ToLower(v) == "true")
}
} }
c.Headers = make(map[string][]string, len(nc.API.HTTPHeaders)+1) c.Headers = make(map[string][]string, len(nc.API.HTTPHeaders)+1)
......
...@@ -68,7 +68,7 @@ func TestAddMultipleGCLive(t *testing.T) { ...@@ -68,7 +68,7 @@ func TestAddMultipleGCLive(t *testing.T) {
go func() { go func() {
defer close(out) defer close(out)
adder.AddAllAndPin(slf) _, _ = adder.AddAllAndPin(slf)
// Ignore errors for clarity - the real bug would be gc'ing files while adding them, not this resultant error // Ignore errors for clarity - the real bug would be gc'ing files while adding them, not this resultant error
}() }()
......
...@@ -15,13 +15,10 @@ import ( ...@@ -15,13 +15,10 @@ import (
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync" dsync "github.com/ipfs/go-datastore/sync"
cfg "github.com/ipfs/go-ipfs-config" cfg "github.com/ipfs/go-ipfs-config"
logging "github.com/ipfs/go-log"
ci "github.com/libp2p/go-libp2p-crypto" ci "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer" peer "github.com/libp2p/go-libp2p-peer"
) )
var log = logging.Logger("node")
type BuildCfg struct { type BuildCfg struct {
// If online is set, the node will have networking enabled // If online is set, the node will have networking enabled
Online bool Online bool
......
...@@ -91,7 +91,7 @@ func GcBlockstoreCtor(bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockst ...@@ -91,7 +91,7 @@ func GcBlockstoreCtor(bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockst
// GcBlockstoreCtor wraps GcBlockstore and adds Filestore support // GcBlockstoreCtor wraps GcBlockstore and adds Filestore support
func FilestoreBlockstoreCtor(repo repo.Repo, bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore, fstore *filestore.Filestore) { func FilestoreBlockstoreCtor(repo repo.Repo, bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore, fstore *filestore.Filestore) {
gclocker, gcbs, bs = GcBlockstoreCtor(bb) gclocker = blockstore.NewGCLocker()
// hash security // hash security
fstore = filestore.NewFilestore(bb, repo.FileManager()) fstore = filestore.NewFilestore(bb, repo.FileManager())
......
...@@ -281,7 +281,7 @@ func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error { ...@@ -281,7 +281,7 @@ func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error {
if !f.AllowFiles { if !f.AllowFiles {
return ErrFilestoreNotEnabled return ErrFilestoreNotEnabled
} }
if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) { if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) { //nolint:staticcheck
return fmt.Errorf("cannot add filestore references outside ipfs root (%s)", f.root) return fmt.Errorf("cannot add filestore references outside ipfs root (%s)", f.root)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论