mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
"named returns" -> "naked returns"
parent
73abfc680b
commit
962830bfa9
@ -464,7 +464,7 @@ func (f *Foo) Location() (lat, long float64, err error)
|
|||||||
|
|
||||||
Naked returns are okay if the function is a handful of lines. Once it's a medium
|
Naked returns are okay if the function is a handful of lines. Once it's a medium
|
||||||
sized function, be explicit with your return values. Corollary: it's not worth it
|
sized function, be explicit with your return values. Corollary: it's not worth it
|
||||||
to name result parameters just because it enables you to use named returns.
|
to name result parameters just because it enables you to use naked returns.
|
||||||
Clarity of docs is always more important than saving a line or two in your function.
|
Clarity of docs is always more important than saving a line or two in your function.
|
||||||
|
|
||||||
Finally, in some cases you need to name a result parameter in order to change
|
Finally, in some cases you need to name a result parameter in order to change
|
||||||
|
Loading…
x
Reference in New Issue
Block a user