Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 intrue
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