pokt-network / pocket

Official implementation of the Pocket Network Protocol v1
https://pokt.network
MIT License
61 stars 33 forks source link

[Linters/CI] fixes current golangci-lint errors #850

Closed okdas closed 12 months ago

okdas commented 1 year ago

Description

Resolves current errors on main related to golangci-lint linters checks not passing.

Summary generated by Reviewpad on 21 Jun 23 22:00 UTC

This pull request fixes current golangci-lint errors. It touches three files, making a total of 17 insertions and 2 deletions. The changes include the removal of a duplicated import statement, the commenting of an unused code element, and the modification of a variable's data type in one function within a Go package. There are also some unused code elements and mocks included in the patch.

Type of change

Please mark the relevant option(s):

List of changes

Resolves the following issues reported by golangci-lint:

app/client/cli/consensus.go:4: File is not `goimports`-ed (goimports)
    "fmt"
p2p/raintree/router.go:58:2: field `nonceDeduper` is unused (unused)
    nonceDeduper          *mempool.GenericFIFOSet[uint64, uint64]
    ^
p2p/utils_test.go:86:6: func `waitForNetworkSimulationCompletion` is unused (unused)
func waitForNetworkSimulationCompletion(t *testing.T, wg *sync.WaitGroup) {
     ^
p2p/utils_test.go:107:6: func `createP2PModules` is unused (unused)
func createP2PModules(t *testing.T, busMocks []*mockModules.MockBus, netMock mocknet.Mocknet) (p2pModules map[string]*p2pModule) {
     ^
p2p/utils_test.go:120:6: func `setupMockNetPeers` is unused (unused)
func setupMockNetPeers(t *testing.T, netMock mocknet.Mocknet, numPeers int) (peerIDs []libp2pPeer.ID) {
     ^
p2p/utils_test.go:149:6: func `createMockRuntimeMgrs` is unused (unused)
func createMockRuntimeMgrs(t *testing.T, numValidators int) []modules.RuntimeMgr {
     ^
p2p/utils_test.go:183:6: func `createMockBuses` is unused (unused)
func createMockBuses(t *testing.T, runtimeMgrs []modules.RuntimeMgr) []*mockModules.MockBus {
     ^
p2p/utils_test.go:230:6: func `prepareBusMock` is unused (unused)
func prepareBusMock(busMock *mockModules.MockBus,
     ^
p2p/utils_test.go:241:6: func `prepareConsensusMock` is unused (unused)
func prepareConsensusMock(t *testing.T, busMock *mockModules.MockBus) *mockModules.MockConsensusModule {
     ^
p2p/utils_test.go:282:6: func `prepareTelemetryMock` is unused (unused)
func prepareTelemetryMock(t *testing.T, busMock *mockModules.MockBus, valId string, wg *sync.WaitGroup, expectedNumNetworkWrites int) *mockModules.MockTelemetryModule {
     ^
p2p/utils_test.go:312:6: func `prepareEventMetricsAgentMock` is unused (unused)
func prepareEventMetricsAgentMock(t *testing.T, valId string, wg *sync.WaitGroup, expectedNumNetworkWrites int) *mockModules.MockEventMetricsAgent {
     ^
okdas commented 1 year ago

@bryanchriswhite can you please check if functions/vars with //nolint:unused are needed or can be deleted? Linter has been complaining that this code is not in use.

bryanchriswhite commented 1 year ago

@okdas have you been running the linter via the make target and/or using --build-tags test? All of those except the nonceDeduper field are definitely used in tests. The `nonceDeduper should be cleaned up in #855 (check about halfway though the commits.

okdas commented 1 year ago

@bryanchriswhite I have not – these issues were reported by the CI. Thank you! I'll check how we can include the build tags for linter in GitHub Actions.

bryanchriswhite commented 1 year ago

I thought I had updated it already in both the makefile and CI but maybe I missed something.

okdas commented 12 months ago

This ticket has been superseded by #885.