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

ci(lint): enable errcheck, errorlint, gci, misspell, nonamedreturns and staticcheck linters #71

Merged
merged 5 commits into from
Mar 26, 2023

Conversation

mmorel-35
Copy link
Contributor

Signed-off-by: Matthieu MOREL [email protected]

Signed-off-by: Matthieu MOREL <[email protected]>
Signed-off-by: Matthieu MOREL <[email protected]>
@mmorel-35 mmorel-35 changed the title ci(lint): enable errorlint, gci, gofmt and misspell linters ci(lint): enable errorlint, gci and misspell linters Mar 23, 2023
Signed-off-by: Matthieu MOREL <[email protected]>
Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

👍 for this change.

Had one qq... also, be great to add some really useful ones like revive, although that should probably land in a later PR to keep the scope of this one straightforward.

.golangci.yml Show resolved Hide resolved
netns_linux.go Show resolved Hide resolved
@mmorel-35 mmorel-35 changed the title ci(lint): enable errorlint, gci and misspell linters ci(lint): enable errcheck, errorlint, gci, misspell, revive and staticcheck linters Mar 24, 2023
@mmorel-35 mmorel-35 force-pushed the errorlint branch 2 times, most recently from f089a27 to e986c62 Compare March 24, 2023 11:23
@mmorel-35 mmorel-35 changed the title ci(lint): enable errcheck, errorlint, gci, misspell, revive and staticcheck linters ci(lint): enable errcheck, errorlint, gci, misspell, nonamedreturns, revive and staticcheck linters Mar 24, 2023
Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

👍 overall, a few small comments

netns_others.go Outdated
return -1, ErrNotImplemented
}

func NewNamed(name string) (NsHandle, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general I prefer the _ convention, however sometimes for primitive types, keeping the arg name is helpful... for example here I'd rather keep this one because even though unused, it clarifies to the caller what the arg is intended for. That way if we do ever implement it, callers are already ready for it.

Same with all the rest of the following args in this file...

Can you please add a per-line exception?

// associated with the network handle.
func (ns NsHandle) UniqueId() string {
func (ns NsHandle) UniqueID() string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a breaking change is it not?

In general I don't mind breaking changes like this where the type checker will complain, but we'd need to ensure to bump the major version.

And also, I do wonder, is it really worth it to make a breaking change purely for a cosmetic lint?

Signed-off-by: Matthieu MOREL <[email protected]>

up

Signed-off-by: Matthieu MOREL <[email protected]>
@mmorel-35 mmorel-35 changed the title ci(lint): enable errcheck, errorlint, gci, misspell, nonamedreturns, revive and staticcheck linters ci(lint): enable errcheck, errorlint, gci, misspell, nonamedreturns and staticcheck linters Mar 25, 2023
Signed-off-by: Matthieu MOREL <[email protected]>
@mmorel-35
Copy link
Contributor Author

mmorel-35 commented Mar 25, 2023

Your two comments are against revive's rules.
I removed it from this PR. It can be added in another if you want to apply it's rules.

@jeffwidman
Copy link
Collaborator

Your two comments are against revive's rules.

Yes, I'm aware, that's why I mentioned adding specific exceptions for violations.

I removed it from this PR. It can be added in another if you want to apply it's rules.

Sounds fine. Thanks for contributing this PR!

@jeffwidman jeffwidman merged commit 364b2a2 into vishvananda:master Mar 26, 2023
@mmorel-35 mmorel-35 deleted the errorlint branch March 26, 2023 00:05
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