golang/go
View on GitHubencoding/binary: Varint signature/docs could benefit from name result parameters
Open
#49,603 opened on Nov 16, 2021
DocumentationNeedsFixhelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
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.