Skip to content

Commit bbc1758

Browse files
authored
CodeReviewComments: avoid using naked returns
1 parent f3e0687 commit bbc1758

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

CodeReviewComments.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,9 @@ is less clear than:
464464
func (f *Foo) Location() (lat, long float64, err error)
465465
```
466466
467-
Naked returns are okay if the function is a handful of lines. Once it's a medium
468-
sized function, be explicit with your return values. Corollary: it's not worth it
469-
to name result parameters just because it enables you to use naked returns.
470-
Clarity of docs is always more important than saving a line or two in your function.
467+
Avoid using naked returns. Corollary: do not name result parameters just
468+
because it enables you to use naked returns. Clarity of docs is always more
469+
important than saving a line or two in your function.
471470
472471
Finally, in some cases you need to name a result parameter in order to change
473472
it in a deferred closure. That is always OK.

0 commit comments

Comments
 (0)