From 40ae33dcdc59ec69db2f4ec8188146cea89e906d Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 15 May 2021 18:07:02 -0700 Subject: [PATCH] fix staticcheck --- dsindex/indexer.go | 6 ++++-- dspinner/pin.go | 3 +-- dspinner/pin_test.go | 4 +--- pin.go | 3 --- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dsindex/indexer.go b/dsindex/indexer.go index e48af2e..e1119ac 100644 --- a/dsindex/indexer.go +++ b/dsindex/indexer.go @@ -127,12 +127,14 @@ func (x *indexer) ForEach(ctx context.Context, key string, fn func(key, value st break } ent := r.Entry - decIdx, err := decode(path.Base(path.Dir(ent.Key))) + var decIdx string + decIdx, err = decode(path.Base(path.Dir(ent.Key))) if err != nil { err = fmt.Errorf("cannot decode index: %v", err) break } - decKey, err := decode(path.Base(ent.Key)) + var decKey string + decKey, err = decode(path.Base(ent.Key)) if err != nil { err = fmt.Errorf("cannot decode key: %v", err) break diff --git a/dspinner/pin.go b/dspinner/pin.go index f9f5ff9..4adf95a 100644 --- a/dspinner/pin.go +++ b/dspinner/pin.go @@ -18,7 +18,6 @@ import ( ipld "github.com/ipfs/go-ipld-format" logging "github.com/ipfs/go-log" "github.com/ipfs/go-merkledag" - mdag "github.com/ipfs/go-merkledag" "github.com/ipfs/go-merkledag/dagutils" "github.com/polydawn/refmt/cbor" "github.com/polydawn/refmt/obj/atlas" @@ -191,7 +190,7 @@ func (p *pinner) Pin(ctx context.Context, node ipld.Node, recurse bool) error { // temporary unlock to fetch the entire graph p.lock.Unlock() // Fetch graph starting at node identified by cid - err = mdag.FetchGraph(ctx, c, p.dserv) + err = merkledag.FetchGraph(ctx, c, p.dserv) p.lock.Lock() if err != nil { return err diff --git a/dspinner/pin_test.go b/dspinner/pin_test.go index 46a2f94..500d3e3 100644 --- a/dspinner/pin_test.go +++ b/dspinner/pin_test.go @@ -893,9 +893,7 @@ func makeStore() (ds.Datastore, ipld.DAGService) { if err != nil { panic(err) } - var dstore ds.Batching - dstore = &batchWrap{ldstore} - + dstore := &batchWrap{ldstore} bstore := blockstore.NewBlockstore(dstore) bserv := bs.New(bstore, offline.Exchange(bstore)) dserv := mdag.NewDAGService(bserv) diff --git a/pin.go b/pin.go index 7e1d886..2bae758 100644 --- a/pin.go +++ b/pin.go @@ -8,11 +8,8 @@ import ( cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" ) -var log = logging.Logger("pin") - const ( linkRecursive = "recursive" linkDirect = "direct"