Y
Hacker News
new
|
ask
|
show
|
jobs
by
macintux
376 days ago
I know diddly/squat about Go, but from similar patterns in aeons past, would "nil == err" work as a way to make it stand out?
1 comments
haiku2077
376 days ago
Just tried this and it appears to be valid in the compiler, formatter and golangci-lint
link
_whiteCaps_
376 days ago
https://en.wikipedia.org/wiki/Yoda_conditions
Works especially well in languages that can make assignments in if statements, e.g:
if foo = 42 { }
link
macintux
376 days ago
Thank you, I was unaware of this label. Quite descriptive.
link