Skip to content

Commit

Permalink
Fixes for golint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Yarger committed Mar 8, 2022
1 parent 5dc3ae7 commit fc74936
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
5 changes: 4 additions & 1 deletion cmd/ipfs/idxprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ func generateContextID() ([]byte, error) {
return nil, err
}
h := sha256.New()
h.Write(data)
if _, err := h.Write(data); err != nil {
return nil, err
}

return h.Sum(nil), nil
}

Expand Down
8 changes: 4 additions & 4 deletions core/coreapi/test/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/ipfs/go-filestore"
"github.com/ipfs/go-ipfs-keystore"
keystore "github.com/ipfs/go-ipfs-keystore"
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/bootstrap"
"github.com/ipfs/go-ipfs/core/coreapi"
Expand All @@ -19,20 +19,20 @@ import (

"github.com/ipfs/go-datastore"
syncds "github.com/ipfs/go-datastore/sync"
"github.com/ipfs/go-ipfs-config"
config "github.com/ipfs/go-ipfs-config"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/interface-go-ipfs-core/tests"
"github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)

const testPeerID = "QmTFauExutTsy4XP6JbMFcw2Wa9645HJt2bTqL6qYDCKfe"

type NodeProvider struct{}

func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) {
mn := mocknet.New(ctx)
mn := mocknet.New()

nodes := make([]*core.IpfsNode, n)
apis := make([]coreiface.CoreAPI, n)
Expand Down
2 changes: 1 addition & 1 deletion core/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewMockNode() (*core.IpfsNode, error) {
// effectively offline, only peer in its network
return core.NewNode(ctx, &core.BuildCfg{
Online: true,
Host: MockHostOption(mocknet.New(ctx)),
Host: MockHostOption(mocknet.New()),
})
}

Expand Down
4 changes: 2 additions & 2 deletions core/node/libp2p/smux.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

config "github.com/ipfs/go-ipfs-config"
"github.com/libp2p/go-libp2p"
smux "github.com/libp2p/go-libp2p-core/mux"
"github.com/libp2p/go-libp2p-core/network"
mplex "github.com/libp2p/go-libp2p-mplex"
yamux "github.com/libp2p/go-libp2p-yamux"
)

func yamuxTransport() smux.Multiplexer {
func yamuxTransport() network.Multiplexer {
tpt := *yamux.DefaultTransport
tpt.AcceptBacklog = 512
if os.Getenv("YAMUX_DEBUG") != "" {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/addcat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
// TODO add to conf. This is tricky because we want 0 values to be functional.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/bench_cat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func benchCat(b *testing.B, data []byte, conf testutil.LatencyConfig) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
// TODO add to conf. This is tricky because we want 0 values to be functional.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/bitswap_wo_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestBitswapWithoutRouting(t *testing.T) {
const numPeers = 4

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()

var nodes []*core.IpfsNode
for i := 0; i < numPeers; i++ {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/three_legged_cat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
// TODO add to conf. This is tricky because we want 0 values to be functional.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/wan_lan_dht_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func RunDHTConnectivity(conf testutil.LatencyConfig, numPeers int) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
Bandwidth: math.MaxInt32,
Expand Down

0 comments on commit fc74936

Please sign in to comment.