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

chore: fix go lint findings #1079

Closed
wants to merge 2 commits into from
Closed

chore: fix go lint findings #1079

wants to merge 2 commits into from

Conversation

toumorokoshi
Copy link
Contributor

Go lint had multiple findings when run on the full codebase.

Fixing those to help ensure future contributors have less friction and confusion wondering if the errors were caused by them.

@toumorokoshi toumorokoshi requested a review from a team as a code owner February 4, 2023 20:42
@@ -46,7 +46,7 @@ type cli struct {
ListRulesFlag bool
}

var ExitForLintFailure = errors.New("found problems during linting")
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was the warning for this? I'd prefer not to unexport this error. Technically it is a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it just needs a comment, so I'm happy to fix it.

What part of it is a breaking change? I checked and it wasn't referred to outside of the main package.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What part of it is a breaking change? I checked and it wasn't referred to outside of the main package.

It is exported, so if anyone has depended upon this in their own code, it would break them. I don't really think it would be smart for someone to depend on something in a cmd/ directory, but it is possible if someone is "scripting" with Go code and handling the errors. If the only problem was missing a comment, let's not even risk annoying someone :)

var ExitForLintFailure = errors.New("found problems during linting")
// ErrExistForLintFailure is an error to indicate that an error
// was found during linting.
var ErrExitForLintFailure = errors.New("found problems during linting")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh can you not change the name either please? That is breaking as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will conflict with the linter, so I guess we'll have to ignore this one.

I'm looking for the way to ignore this (// nolint:all isn't doing the trick even), but in the meantime, I just noticed that golint was deprecated: golangci/golangci-lint#1892 and staticheck is recommended as a replacement.

Should I do that work here? My only motivation for doing it now is that nolint isn't working for me.

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 made #1084 which has everything working with staticcheck instead. or I could merge this one in (probably will not be able to fix this one) and do staticcheck after. WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's just go with your staticcheck PR, if all of the changes are the same anyways. Good call on switching, thank you.

Go lint had multiple findings when run on the full codebase.

Fixing those to help ensure future contributors have less friction
and confusion wondering if the errors were caused by them.
@noahdietz
Copy link
Collaborator

Closing in favor of #1084.

@noahdietz noahdietz closed this Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants