Repository navigation
Replies: 1 comment 2 replies
Why not? |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I am evaluating a project and ran staticcheck on it. I stumbled on "don't use Yoda conditions":
I also found the related (but not the same, will elaborate later) #410. From there, I tried with putting the string in a constant:
and this indeed does NOT trigger a warning.
On the other hand, I think that this case (conditional reading from a channel) is different from #410: in the issue, it was indeed possible not to do Yoda:
from
to
but in the case I am presenting, with the channel, it is not possible to switch LHS with the RHS, from:
to
Opinions ?
Thanks!
All reactions