fix staticcheck

This commit was moved from ipfs/interface-go-ipfs-core@08bd316e61

This commit was moved from ipfs/boxo@5df09f8425
This commit is contained in:
Marten Seemann 2021-06-02 09:11:14 -07:00
parent 3826afdfcf
commit fb0a7edf12
10 changed files with 16 additions and 17 deletions

View File

@ -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)

View File

@ -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
})

View File

@ -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
})

View File

@ -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
})

View File

@ -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"
@ -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
})
@ -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())
}
}
@ -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 {

View File

@ -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
})

View File

@ -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
})

View File

@ -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
})

View File

@ -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
})

View File

@ -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
})
@ -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)
}