Address some lint warnings

This commit is contained in:
Łukasz Magiera
2019-07-02 15:05:43 +02:00
parent 7fdd369283
commit 4fcdd4a400
7 changed files with 21 additions and 6 deletions
+5
View File
@@ -6,12 +6,14 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
)
// Version provides various build-time information
type Version struct {
Version string
// TODO: git commit / os / genesis cid?
}
// API is a low-level interface to the Filecoin network
type API interface {
// chain
@@ -71,6 +73,9 @@ type API interface {
// // ID (on cli - print with other info)
// ID returns peerID of libp2p node backing this API
ID(context.Context) (peer.ID, error)
// Version provides information about API provider
Version(context.Context) (Version, error)
}
+3
View File
@@ -6,6 +6,7 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
)
// Struct implements API passing calls to user-provided function values.
type Struct struct {
Internal struct {
ID func(context.Context) (peer.ID, error)
@@ -13,10 +14,12 @@ type Struct struct {
}
}
// ID implements API.ID
func (c *Struct) ID(ctx context.Context) (peer.ID, error) {
return c.Internal.ID(ctx)
}
// Version implements API.Version
func (c *Struct) Version(ctx context.Context) (Version, error) {
return c.Internal.Version(ctx)
}
+3
View File
@@ -8,11 +8,14 @@ import (
"github.com/filecoin-project/go-lotus/build"
)
// APIBuilder is a function which is invoked in test suite to provide
// test nodes and networks
type APIBuilder func() api.API
type testSuite struct {
makeNode APIBuilder
}
// TestApis is the entry point to API test suite
func TestApis(t *testing.T, b APIBuilder) {
ts := testSuite{
makeNode: b,