this post was submitted on 24 Nov 2023
7 points (100.0% liked)

Go programming language discussion

1406 readers
1 users here now

founded 5 years ago
MODERATORS
top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 1 year ago (1 children)

This says when it's ok to use them and why it should be limited

https://go.dev/tour/basics/7

Personally, I don't like them. Makes things awkward to read imo

[–] [email protected] 4 points 1 year ago

Yeah, I tend to agree, naked returns are hard to read and they don't really add much in terms of value.

I avoid them in my code.

[–] stifle867 1 points 1 year ago

You can usually restructure your code to avoid them and would suggest to do so where possible. In the same vein as GOTO being bad practice. It's simpler being able to follow a function's flow from top to bottom.