Skip to content

Commit

Permalink
Merge pull request ipfs/interface-go-ipfs-core#72 from ipfs/fix-stati…
Browse files Browse the repository at this point in the history
…ccheck

fix staticcheck

This commit was moved from ipfs/interface-go-ipfs-core@5191300
  • Loading branch information
marten-seemann authored Jun 2, 2021
2 parents eca2e5e + 2203b95 commit 495f5b0
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 coreapi/iface/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 495f5b0

Please sign in to comment.