diff --git a/.golangci.yml b/.golangci.yml index dcc216179..8f25233e6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,6 +26,9 @@ issues: - path: node/modules/lp2p linters: - golint + - path: ".*_test.go" + linters: + - gosec linters-settings: goconst: diff --git a/chain/actors.go b/chain/actors.go index e8159e1a1..87e9094ca 100644 --- a/chain/actors.go +++ b/chain/actors.go @@ -3,6 +3,7 @@ package chain import ( "context" "fmt" + "github.com/filecoin-project/go-lotus/chain/address" "github.com/ipfs/go-cid" diff --git a/chain/address/address_test.go b/chain/address/address_test.go index 5e119d39a..c55116544 100644 --- a/chain/address/address_test.go +++ b/chain/address/address_test.go @@ -54,6 +54,7 @@ func TestVectorsIDAddress(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(fmt.Sprintf("testing actorID address: %s", tc.expected), func(t *testing.T) { assert := assert.New(t) @@ -149,6 +150,7 @@ func TestVectorSecp256k1Address(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(fmt.Sprintf("testing secp256k1 address: %s", tc.expected), func(t *testing.T) { assert := assert.New(t) @@ -221,6 +223,7 @@ func TestVectorActorAddress(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(fmt.Sprintf("testing Actor address: %s", tc.expected), func(t *testing.T) { assert := assert.New(t) @@ -302,6 +305,7 @@ func TestVectorBLSAddress(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(fmt.Sprintf("testing bls address: %s", tc.expected), func(t *testing.T) { assert := assert.New(t) @@ -348,6 +352,7 @@ func TestInvalidStringAddresses(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(fmt.Sprintf("testing string address: %s", tc.expetErr), func(t *testing.T) { assert := assert.New(t) @@ -382,6 +387,7 @@ func TestInvalidByteAddresses(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(fmt.Sprintf("testing byte address: %s", tc.expetErr), func(t *testing.T) { assert := assert.New(t) diff --git a/chain/blocksync.go b/chain/blocksync.go index 87c4e3ffe..14641fa9e 100644 --- a/chain/blocksync.go +++ b/chain/blocksync.go @@ -4,12 +4,14 @@ import ( "bufio" "context" "fmt" - "github.com/filecoin-project/go-lotus/lib/cborrpc" + "math/rand" + "sync" + exchange "github.com/ipfs/go-ipfs-exchange-interface" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/protocol" - "math/rand" - "sync" + + "github.com/filecoin-project/go-lotus/lib/cborrpc" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" diff --git a/chain/mining.go b/chain/mining.go index d30d16b95..06a9d1050 100644 --- a/chain/mining.go +++ b/chain/mining.go @@ -5,12 +5,13 @@ import ( "fmt" "time" - "github.com/filecoin-project/go-lotus/chain/address" - bls "github.com/filecoin-project/go-lotus/lib/bls-signatures" cid "github.com/ipfs/go-cid" hamt "github.com/ipfs/go-hamt-ipld" "github.com/pkg/errors" sharray "github.com/whyrusleeping/sharray" + + "github.com/filecoin-project/go-lotus/chain/address" + bls "github.com/filecoin-project/go-lotus/lib/bls-signatures" ) type Miner struct { diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index a8e63bc3c..d56dd8e40 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -4,9 +4,10 @@ import ( "context" "fmt" - "github.com/filecoin-project/go-lotus/chain" logging "github.com/ipfs/go-log" pubsub "github.com/libp2p/go-libp2p-pubsub" + + "github.com/filecoin-project/go-lotus/chain" ) var log = logging.Logger("sub") diff --git a/daemon/rpc.go b/daemon/rpc.go index bccf6b529..1426f38ce 100644 --- a/daemon/rpc.go +++ b/daemon/rpc.go @@ -1,10 +1,10 @@ package daemon import ( - "github.com/filecoin-project/go-lotus/lib/jsonrpc" "net/http" "github.com/filecoin-project/go-lotus/api" + "github.com/filecoin-project/go-lotus/lib/jsonrpc" ) func serveRPC(api api.API) error { diff --git a/node/hello/hello.go b/node/hello/hello.go index d45aca7c7..974d6e681 100644 --- a/node/hello/hello.go +++ b/node/hello/hello.go @@ -3,15 +3,16 @@ package hello import ( "context" "fmt" - "github.com/filecoin-project/go-lotus/chain" - "github.com/filecoin-project/go-lotus/lib/cborrpc" - "github.com/libp2p/go-libp2p-core/host" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" logging "github.com/ipfs/go-log" + "github.com/libp2p/go-libp2p-core/host" inet "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" + + "github.com/filecoin-project/go-lotus/chain" + "github.com/filecoin-project/go-lotus/lib/cborrpc" ) const ProtocolID = "/fil/hello/1.0.0" diff --git a/node/modules/core.go b/node/modules/core.go index 7bdb2ab3f..91aadd659 100644 --- a/node/modules/core.go +++ b/node/modules/core.go @@ -2,8 +2,7 @@ package modules import ( "context" - "github.com/filecoin-project/go-lotus/chain" - "github.com/filecoin-project/go-lotus/node/modules/helpers" + "github.com/ipfs/go-bitswap" "github.com/ipfs/go-bitswap/network" blockstore "github.com/ipfs/go-ipfs-blockstore" @@ -14,6 +13,9 @@ import ( "github.com/libp2p/go-libp2p-core/routing" record "github.com/libp2p/go-libp2p-record" "go.uber.org/fx" + + "github.com/filecoin-project/go-lotus/chain" + "github.com/filecoin-project/go-lotus/node/modules/helpers" ) var log = logging.Logger("modules") diff --git a/node/modules/services.go b/node/modules/services.go index f1af01436..099b9e125 100644 --- a/node/modules/services.go +++ b/node/modules/services.go @@ -1,14 +1,15 @@ package modules import ( - "github.com/filecoin-project/go-lotus/chain" - "github.com/filecoin-project/go-lotus/chain/sub" - "github.com/filecoin-project/go-lotus/node/hello" - "github.com/filecoin-project/go-lotus/node/modules/helpers" "github.com/libp2p/go-libp2p-core/host" inet "github.com/libp2p/go-libp2p-core/network" pubsub "github.com/libp2p/go-libp2p-pubsub" "go.uber.org/fx" + + "github.com/filecoin-project/go-lotus/chain" + "github.com/filecoin-project/go-lotus/chain/sub" + "github.com/filecoin-project/go-lotus/node/hello" + "github.com/filecoin-project/go-lotus/node/modules/helpers" ) func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) { diff --git a/node/modules/testing/genesis.go b/node/modules/testing/genesis.go index dedf36279..094302286 100644 --- a/node/modules/testing/genesis.go +++ b/node/modules/testing/genesis.go @@ -1,9 +1,10 @@ package testing import ( + blockstore "github.com/ipfs/go-ipfs-blockstore" + "github.com/filecoin-project/go-lotus/chain" "github.com/filecoin-project/go-lotus/node/modules" - blockstore "github.com/ipfs/go-ipfs-blockstore" ) func MakeGenesis(bs blockstore.Blockstore, w *chain.Wallet) (modules.Genesis, error) {