@cryptotaxi247 / kubo / commits / fb0a7edf1

fix staticcheck

This commit was moved from ipfs/interface-go-ipfs-core@08bd316e61238880f341d7061c518c2a62830bd9 This commit was moved from ipfs/boxo@5df09f84256c8b490f356c161c96b49d3a46bfd0

Marten Seemann committed Jun 2, 2021 at 09:11 UTC fb0a7edf12a24be1b80fc5a487c183e70048062a
10 files changed +16 -17
core/coreiface/tests/api.go
+1 -1
@@ -9,7 +9,7 @@ import (
9 coreiface "github.com/ipfs/interface-go-ipfs-core"
10 )
11
12 -var apiNotImplemented = errors.New("api not implemented")
12 +var errAPINotImplemented = errors.New("api not implemented")
13
14 func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
15 api, err := tp.MakeAPISwarm(ctx, false, 1)
core/coreiface/tests/block.go
+1 -1
@@ -32,7 +32,7 @@ func cborBlock() io.Reader {
32 func (tp *TestSuite) TestBlock(t *testing.T) {
33 tp.hasApi(t, func(api coreiface.CoreAPI) error {
34 if api.Block() == nil {
35 - return apiNotImplemented
35 + return errAPINotImplemented
36 }
37 return nil
38 })
core/coreiface/tests/dag.go
+1 -1
@@ -18,7 +18,7 @@ import (
18 func (tp *TestSuite) TestDag(t *testing.T) {
19 tp.hasApi(t, func(api coreiface.CoreAPI) error {
20 if api.Dag() == nil {
21 - return apiNotImplemented
21 + return errAPINotImplemented
22 }
23 return nil
24 })
core/coreiface/tests/dht.go
+1 -1
@@ -13,7 +13,7 @@ import (
13 func (tp *TestSuite) TestDht(t *testing.T) {
14 tp.hasApi(t, func(api iface.CoreAPI) error {
15 if api.Dht() == nil {
16 - return apiNotImplemented
16 + return errAPINotImplemented
17 }
18 return nil
19 })
core/coreiface/tests/key.go
+6 -6
@@ -5,8 +5,7 @@ import (
5 "strings"
6 "testing"
7
8 - cid "github.com/ipfs/go-cid"
9 - coreiface "github.com/ipfs/interface-go-ipfs-core"
8 + "github.com/ipfs/go-cid"
9 iface "github.com/ipfs/interface-go-ipfs-core"
10 opt "github.com/ipfs/interface-go-ipfs-core/options"
11 mbase "github.com/multiformats/go-multibase"
@@ -15,7 +14,7 @@ import (
14 func (tp *TestSuite) TestKey(t *testing.T) {
15 tp.hasApi(t, func(api iface.CoreAPI) error {
16 if api.Key() == nil {
18 - return apiNotImplemented
17 + return errAPINotImplemented
18 }
19 return nil
20 })
@@ -67,8 +66,8 @@ func (tp *TestSuite) TestListSelf(t *testing.T) {
66 t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name())
67 }
68
70 - if keys[0].Path().String() != "/ipns/"+coreiface.FormatKeyID(self.ID()) {
71 - t.Errorf("expected the key to have path '/ipns/%s', got '%s'", coreiface.FormatKeyID(self.ID()), keys[0].Path().String())
69 + if keys[0].Path().String() != "/ipns/"+iface.FormatKeyID(self.ID()) {
70 + t.Errorf("expected the key to have path '/ipns/%s', got '%s'", iface.FormatKeyID(self.ID()), keys[0].Path().String())
71 }
72 }
73
@@ -185,9 +184,10 @@ func (tp *TestSuite) TestGenerateSize(t *testing.T) {
184 }
185
186 func (tp *TestSuite) TestGenerateType(t *testing.T) {
187 + t.Skip("disabled until libp2p/specs#111 is fixed")
188 +
189 ctx, cancel := context.WithCancel(context.Background())
190 defer cancel()
190 - t.Skip("disabled until libp2p/specs#111 is fixed")
191
192 api, err := tp.makeAPI(ctx)
193 if err != nil {
core/coreiface/tests/name.go
+1 -1
@@ -19,7 +19,7 @@ import (
19 func (tp *TestSuite) TestName(t *testing.T) {
20 tp.hasApi(t, func(api coreiface.CoreAPI) error {
21 if api.Name() == nil {
22 - return apiNotImplemented
22 + return errAPINotImplemented
23 }
24 return nil
25 })
core/coreiface/tests/object.go
+1 -1
@@ -15,7 +15,7 @@ import (
15 func (tp *TestSuite) TestObject(t *testing.T) {
16 tp.hasApi(t, func(api iface.CoreAPI) error {
17 if api.Object() == nil {
18 - return apiNotImplemented
18 + return errAPINotImplemented
19 }
20 return nil
21 })
core/coreiface/tests/pin.go
+1 -1
@@ -18,7 +18,7 @@ import (
18 func (tp *TestSuite) TestPin(t *testing.T) {
19 tp.hasApi(t, func(api iface.CoreAPI) error {
20 if api.Pin() == nil {
21 - return apiNotImplemented
21 + return errAPINotImplemented
22 }
23 return nil
24 })
core/coreiface/tests/pubsub.go
+1 -1
@@ -12,7 +12,7 @@ import (
12 func (tp *TestSuite) TestPubSub(t *testing.T) {
13 tp.hasApi(t, func(api iface.CoreAPI) error {
14 if api.PubSub() == nil {
15 - return apiNotImplemented
15 + return errAPINotImplemented
16 }
17 return nil
18 })
core/coreiface/tests/unixfs.go
+2 -3
@@ -31,7 +31,7 @@ import (
31 func (tp *TestSuite) TestUnixfs(t *testing.T) {
32 tp.hasApi(t, func(api coreiface.CoreAPI) error {
33 if api.Unixfs() == nil {
34 - return apiNotImplemented
34 + return errAPINotImplemented
35 }
36 return nil
37 })
@@ -1035,8 +1035,7 @@ func (tp *TestSuite) TestGetReadAt(t *testing.T) {
1035
1036 origR := bytes.NewReader(orig)
1037
1038 - r, err = api.Unixfs().Get(ctx, p)
1039 - if err != nil {
1038 + if _, err := api.Unixfs().Get(ctx, p); err != nil {
1039 t.Fatal(err)
1040 }
1041