Skip to content

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

Closed
okdas wants to merge 1 commit intomainfrom
chore/fix-linters
Closed

[Linters/CI] fixes current golangci-lint errors#850
okdas wants to merge 1 commit intomainfrom
chore/fix-linters

Conversation

@okdas
Copy link
Copy Markdown
Contributor

@okdas okdas commented Jun 21, 2023

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):

  • Code health or cleanup

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 okdas added the code health Nice to have code improvement label Jun 21, 2023
@okdas okdas requested a review from bryanchriswhite June 21, 2023 22:00
@okdas okdas self-assigned this Jun 21, 2023
@reviewpad reviewpad bot added the small Pull request is small label Jun 21, 2023
@okdas okdas changed the title fixes current golangci-lint errors [Linters/CI] fixes current golangci-lint errors Jun 21, 2023
@okdas
Copy link
Copy Markdown
Contributor Author

okdas commented Jun 21, 2023

@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
Copy link
Copy Markdown
Collaborator

@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
Copy link
Copy Markdown
Contributor Author

okdas commented Jun 28, 2023

@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
Copy link
Copy Markdown
Collaborator

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

@okdas okdas mentioned this pull request Jul 5, 2023
11 tasks
@okdas
Copy link
Copy Markdown
Contributor Author

okdas commented Jul 6, 2023

This ticket has been superseded by #885.

@okdas okdas closed this Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health Nice to have code improvement small Pull request is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants