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

encoding/binary: Varint signature/docs could benefit from name result parameters #49603

Open
bradfitz opened this issue Nov 16, 2021 · 3 comments
Labels
Documentation Issues describing a change to documentation. help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

https://pkg.go.dev/encoding/binary@master#Varint says:

func Varint(buf []byte) (int64, int)

Varint decodes an int64 from buf and returns that value and the number of bytes read (> 0). If an error occurred, the value is 0 and the number of bytes n is <= 0 with the following meaning:

n == 0: buf too small
n  < 0: value larger than 64 bits (overflow)
        and -n is the number of bytes read

--

That signature and docs (referencing n that's never named) are really asking to have named results.

@gopherbot gopherbot added the Documentation Issues describing a change to documentation. label Nov 16, 2021
@ianlancetaylor ianlancetaylor added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Nov 16, 2021
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Nov 16, 2021
@Shisthruna28
Copy link

@ianlancetaylor I would like to contribute to this, can you explain what changes need to be done?

@seankhliao
Copy link
Member

@Shisthruna28 adjust the function signature to name the results in a way that matches the documentation
our contributing process can be found here: https://golang.org/doc/contribute

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/364277 mentions this issue: docs: improved function signature with named result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues describing a change to documentation. help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants