Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update golangci-lint to v1.56.1 #2714

Merged
merged 12 commits into from
Feb 10, 2024
Merged

Conversation

dhrubabasu
Copy link
Contributor

@dhrubabasu dhrubabasu commented Feb 8, 2024

Why this should be merged

Linters 🧹

How this works

How this was tested

CI

@dhrubabasu dhrubabasu added the ci This focuses on changes to the CI process label Feb 8, 2024
@dhrubabasu dhrubabasu self-assigned this Feb 8, 2024
@dhrubabasu dhrubabasu marked this pull request as draft February 8, 2024 02:10
@dhrubabasu dhrubabasu marked this pull request as ready for review February 8, 2024 06:35
@dhrubabasu dhrubabasu changed the title Update golangci-lint to v1.56.0 Update golangci-lint to v1.56.1 Feb 8, 2024
Copy link
Contributor

@StephenButtolph StephenButtolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sick 🔥 🚀

snow/consensus/snowball/tree.go Outdated Show resolved Hide resolved
vms/platformvm/service_test.go Outdated Show resolved Hide resolved
vms/platformvm/validator_set_property_test.go Outdated Show resolved Hide resolved
vms/proposervm/proposer/windower_test.go Outdated Show resolved Hide resolved
@StephenButtolph StephenButtolph added this to the v1.11.0 milestone Feb 9, 2024
@@ -300,13 +300,13 @@ func (vtx *uniqueVertex) String() string {
len(txs),
))

parentFormat := fmt.Sprintf("\n Parent[%s]: ID = %%s, Status = %%s",
parentFormat := fmt.Sprintf("\n Parent[%s]: ID = %%s, Status = %%s", //nolint:perfsprint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we disabling linting here? There were other places where we were able to replace Sprintf with simpler alternative. What's the difference here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried changing it a few times but the code got more confusing. We don't stringify the unique vertex enough to sacrifice code clarity for performance IMO

keys := make([]*secp256k1.PrivateKey, 5)
for i := range keys {
key, err := secp256k1.NewPrivateKey()
require.NoError(err)
require.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? Is there a linter complaining about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we use require, we should use it with the most scoped t variable. Further down this test, we do require := require.New(t) in the sub-test. The linter was complaining that the sub-test t *testing.T was unused.

@@ -21,7 +21,7 @@ type noOpTracer struct {
}

func (n noOpTracer) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
return n.t.Start(ctx, spanName, opts...)
return n.t.Start(ctx, spanName, opts...) //nolint:spancheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the linter suggests there is a possible memory leak here. Should we end the spam right away for the noop tracer instead of silencing the linter?
NoOpTracer does not seem to be used in prod code currently but I think it's best to avoid any possible memory leak, even in UTs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The consumer should be ending the span. The linter is complaining that the returned span is unassigned so there could be a possible memory leak

Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple of points where we may avoid silencing the linter. All in all nice cleanup!

@StephenButtolph StephenButtolph added this pull request to the merge queue Feb 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 9, 2024
@StephenButtolph StephenButtolph added this pull request to the merge queue Feb 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 10, 2024
@StephenButtolph StephenButtolph merged commit c8a5d0b into master Feb 10, 2024
34 checks passed
@StephenButtolph StephenButtolph deleted the golangci-lint-version-56-0 branch February 10, 2024 18:31
chand1012 pushed a commit to multisig-labs/avalanchego that referenced this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci This focuses on changes to the CI process
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants