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

Lint Go Caveats #3011

Closed
wants to merge 2 commits into from
Closed

Lint Go Caveats #3011

wants to merge 2 commits into from

Conversation

jaitaiwan
Copy link
Contributor

@jaitaiwan jaitaiwan commented Jul 6, 2023

In almost all cases, checking to see if an interface is nil is an anti-practice that can land the coder in hot water.

As documented in this simple Go playground, the average coder would expect that when removing line 26, the conditional check of a == nil would result in true however this is the opposite of what happens:
https://go.dev/play/p/WdL4mKbocyY?v=goprev

This is due to a known function of Go but it's almost definite that coders working on the ARO-RP will have introduced this in many places in the repository and they are yet to bite us.

This PR creates a custom linting rule that checks for where this may happen and raises a warning to alert the coder that this is probably not meant to be there. In the future this should be set to an error which can be ignored on a case-by-case basis.

Internal reference: ARO-3463

@jaitaiwan jaitaiwan added size-small Size small work-in-progress skippy pull requests raised by member of Team Skippy labels Jul 6, 2023
@jaitaiwan jaitaiwan self-assigned this Jul 6, 2023
@github-actions github-actions bot added the needs-rebase branch needs a rebase label Jul 13, 2023
@github-actions
Copy link

Please rebase pull request.

@jaitaiwan
Copy link
Contributor Author

Found that the linting effort I was trying to do was impossible. Closing it out as wont-do.

@jaitaiwan jaitaiwan closed this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase branch needs a rebase size-small Size small skippy pull requests raised by member of Team Skippy work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant