mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
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:
parent
3826afdfcf
commit
fb0a7edf12
@ -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)
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user