this post was submitted on 23 Apr 2026
6 points (100.0% liked)
Golang
2737 readers
1 users here now
This is a community dedicated to the go programming language.
Useful Links:
Rules:
- Posts must be relevant to Go
- No NSFW content
- No hate speech, bigotry, etc
- Try to keep discussions on topic
- No spam of tools/companies/advertisements
- It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Coming from C (with MISRA and flexelint) I also thought this idiom was a bit 'ick' in Go.. but I guess they feel a return in an if-block makes the else redundant.
I was taught (again, in C/C++) that one should strive for single return points in functions, so actually either of these forms bug me to some extent.
In Go one can name the return variable(s) in the func declaration line, eg.
...but that's not 'idiomatic' Go either :)