Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Commit 5191300

Browse files
Merge pull request #72 from ipfs/fix-staticcheck
fix staticcheck
2 parents 67ba38f + 08bd316 commit 5191300

File tree

10 files changed

+16
-17
lines changed

10 files changed

+16
-17
lines changed

Diff for: tests/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
coreiface "github.com/ipfs/interface-go-ipfs-core"
1010
)
1111

12-
var apiNotImplemented = errors.New("api not implemented")
12+
var errAPINotImplemented = errors.New("api not implemented")
1313

1414
func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
1515
api, err := tp.MakeAPISwarm(ctx, false, 1)

Diff for: tests/block.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func cborBlock() io.Reader {
3232
func (tp *TestSuite) TestBlock(t *testing.T) {
3333
tp.hasApi(t, func(api coreiface.CoreAPI) error {
3434
if api.Block() == nil {
35-
return apiNotImplemented
35+
return errAPINotImplemented
3636
}
3737
return nil
3838
})

Diff for: tests/dag.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
func (tp *TestSuite) TestDag(t *testing.T) {
1919
tp.hasApi(t, func(api coreiface.CoreAPI) error {
2020
if api.Dag() == nil {
21-
return apiNotImplemented
21+
return errAPINotImplemented
2222
}
2323
return nil
2424
})

Diff for: tests/dht.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func (tp *TestSuite) TestDht(t *testing.T) {
1414
tp.hasApi(t, func(api iface.CoreAPI) error {
1515
if api.Dht() == nil {
16-
return apiNotImplemented
16+
return errAPINotImplemented
1717
}
1818
return nil
1919
})

Diff for: tests/key.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"strings"
66
"testing"
77

8-
cid "github.com/ipfs/go-cid"
9-
coreiface "github.com/ipfs/interface-go-ipfs-core"
8+
"github.com/ipfs/go-cid"
109
iface "github.com/ipfs/interface-go-ipfs-core"
1110
opt "github.com/ipfs/interface-go-ipfs-core/options"
1211
mbase "github.com/multiformats/go-multibase"
@@ -15,7 +14,7 @@ import (
1514
func (tp *TestSuite) TestKey(t *testing.T) {
1615
tp.hasApi(t, func(api iface.CoreAPI) error {
1716
if api.Key() == nil {
18-
return apiNotImplemented
17+
return errAPINotImplemented
1918
}
2019
return nil
2120
})
@@ -67,8 +66,8 @@ func (tp *TestSuite) TestListSelf(t *testing.T) {
6766
t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name())
6867
}
6968

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())
7271
}
7372
}
7473

@@ -185,9 +184,10 @@ func (tp *TestSuite) TestGenerateSize(t *testing.T) {
185184
}
186185

187186
func (tp *TestSuite) TestGenerateType(t *testing.T) {
187+
t.Skip("disabled until libp2p/specs#111 is fixed")
188+
188189
ctx, cancel := context.WithCancel(context.Background())
189190
defer cancel()
190-
t.Skip("disabled until libp2p/specs#111 is fixed")
191191

192192
api, err := tp.makeAPI(ctx)
193193
if err != nil {

Diff for: tests/name.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
func (tp *TestSuite) TestName(t *testing.T) {
2020
tp.hasApi(t, func(api coreiface.CoreAPI) error {
2121
if api.Name() == nil {
22-
return apiNotImplemented
22+
return errAPINotImplemented
2323
}
2424
return nil
2525
})

Diff for: tests/object.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
func (tp *TestSuite) TestObject(t *testing.T) {
1616
tp.hasApi(t, func(api iface.CoreAPI) error {
1717
if api.Object() == nil {
18-
return apiNotImplemented
18+
return errAPINotImplemented
1919
}
2020
return nil
2121
})

Diff for: tests/pin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
func (tp *TestSuite) TestPin(t *testing.T) {
1919
tp.hasApi(t, func(api iface.CoreAPI) error {
2020
if api.Pin() == nil {
21-
return apiNotImplemented
21+
return errAPINotImplemented
2222
}
2323
return nil
2424
})

Diff for: tests/pubsub.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
func (tp *TestSuite) TestPubSub(t *testing.T) {
1313
tp.hasApi(t, func(api iface.CoreAPI) error {
1414
if api.PubSub() == nil {
15-
return apiNotImplemented
15+
return errAPINotImplemented
1616
}
1717
return nil
1818
})

Diff for: tests/unixfs.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
func (tp *TestSuite) TestUnixfs(t *testing.T) {
3232
tp.hasApi(t, func(api coreiface.CoreAPI) error {
3333
if api.Unixfs() == nil {
34-
return apiNotImplemented
34+
return errAPINotImplemented
3535
}
3636
return nil
3737
})
@@ -1035,8 +1035,7 @@ func (tp *TestSuite) TestGetReadAt(t *testing.T) {
10351035

10361036
origR := bytes.NewReader(orig)
10371037

1038-
r, err = api.Unixfs().Get(ctx, p)
1039-
if err != nil {
1038+
if _, err := api.Unixfs().Get(ctx, p); err != nil {
10401039
t.Fatal(err)
10411040
}
10421041

0 commit comments

Comments
 (0)