Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A poll: whether almost all function/method declarations should come with named return values unconditionally #23

Closed
zerkms opened this issue Jul 16, 2018 · 0 comments
Milestone

Comments

@zerkms
Copy link
Member

zerkms commented Jul 16, 2018

For code like

func (u *UUID) decodeHashLike(t []byte) (err error) {
    src := t[:]
    dst := u[:]

    if _, err = hex.Decode(dst, src); err != nil {
        return err
    }
    return
}

or

func (u UUID) MarshalBinary() (data []byte, err error) {
    data = u.Bytes()
    return
}

named return values to me don't add any value but mental overhead.

I suggest to vote whether we keep it as-is (then the "rule" should be standardised - so that it was applied consistently, now not all functions have it) or remove, unless it really is one of those rare cases when it makes something "more readable" (and yes, I understand it's subjective).

🎉 - to keep and standardise
❤️ - to remove

@acln0 acln0 added this to the 2.0.0 milestone Jul 16, 2018
@zerkms zerkms closed this as completed Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants