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

Commit

Permalink
fix staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Jun 2, 2021
1 parent 67ba38f commit 08bd316
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion tests/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
coreiface "github.com/ipfs/interface-go-ipfs-core"
)

var apiNotImplemented = errors.New("api not implemented")
var errAPINotImplemented = errors.New("api not implemented")

func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) {
api, err := tp.MakeAPISwarm(ctx, false, 1)
Expand Down
2 changes: 1 addition & 1 deletion tests/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func cborBlock() io.Reader {
func (tp *TestSuite) TestBlock(t *testing.T) {
tp.hasApi(t, func(api coreiface.CoreAPI) error {
if api.Block() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion tests/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func (tp *TestSuite) TestDag(t *testing.T) {
tp.hasApi(t, func(api coreiface.CoreAPI) error {
if api.Dag() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion tests/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func (tp *TestSuite) TestDht(t *testing.T) {
tp.hasApi(t, func(api iface.CoreAPI) error {
if api.Dht() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
12 changes: 6 additions & 6 deletions tests/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"strings"
"testing"

cid "github.com/ipfs/go-cid"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/go-cid"
iface "github.com/ipfs/interface-go-ipfs-core"
opt "github.com/ipfs/interface-go-ipfs-core/options"
mbase "github.com/multiformats/go-multibase"
Expand All @@ -15,7 +14,7 @@ import (
func (tp *TestSuite) TestKey(t *testing.T) {
tp.hasApi(t, func(api iface.CoreAPI) error {
if api.Key() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down Expand Up @@ -67,8 +66,8 @@ func (tp *TestSuite) TestListSelf(t *testing.T) {
t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name())
}

if keys[0].Path().String() != "/ipns/"+coreiface.FormatKeyID(self.ID()) {
t.Errorf("expected the key to have path '/ipns/%s', got '%s'", coreiface.FormatKeyID(self.ID()), keys[0].Path().String())
if keys[0].Path().String() != "/ipns/"+iface.FormatKeyID(self.ID()) {
t.Errorf("expected the key to have path '/ipns/%s', got '%s'", iface.FormatKeyID(self.ID()), keys[0].Path().String())
}
}

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

func (tp *TestSuite) TestGenerateType(t *testing.T) {
t.Skip("disabled until libp2p/specs#111 is fixed")

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
t.Skip("disabled until libp2p/specs#111 is fixed")

api, err := tp.makeAPI(ctx)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tests/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
func (tp *TestSuite) TestName(t *testing.T) {
tp.hasApi(t, func(api coreiface.CoreAPI) error {
if api.Name() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion tests/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func (tp *TestSuite) TestObject(t *testing.T) {
tp.hasApi(t, func(api iface.CoreAPI) error {
if api.Object() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func (tp *TestSuite) TestPin(t *testing.T) {
tp.hasApi(t, func(api iface.CoreAPI) error {
if api.Pin() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func (tp *TestSuite) TestPubSub(t *testing.T) {
tp.hasApi(t, func(api iface.CoreAPI) error {
if api.PubSub() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down
5 changes: 2 additions & 3 deletions tests/unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
func (tp *TestSuite) TestUnixfs(t *testing.T) {
tp.hasApi(t, func(api coreiface.CoreAPI) error {
if api.Unixfs() == nil {
return apiNotImplemented
return errAPINotImplemented
}
return nil
})
Expand Down Expand Up @@ -1035,8 +1035,7 @@ func (tp *TestSuite) TestGetReadAt(t *testing.T) {

origR := bytes.NewReader(orig)

r, err = api.Unixfs().Get(ctx, p)
if err != nil {
if _, err := api.Unixfs().Get(ctx, p); err != nil {
t.Fatal(err)
}

Expand Down

0 comments on commit 08bd316

Please sign in to comment.