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: reorg documentation for PutVarint and PutUvarint #7306

Closed
lukescott opened this issue Feb 11, 2014 · 5 comments
Closed

encoding/binary: reorg documentation for PutVarint and PutUvarint #7306

lukescott opened this issue Feb 11, 2014 · 5 comments

Comments

@lukescott
Copy link

Looking at the documentation for encoding/binary, the only methods for encoding ints
that jump out is PutVarint and PutUvarint. Part of this is because the ByteOrder methods
do not show up in the index (see issue #5860). If you click on these functions in the
index the descriptions read like this:

"PutUvarint encodes a uint64 into buf and returns the number of bytes written. If
the buffer is too small, PutUvarint will panic."

This says nothing about the format. One might assume this uses twos-complement, but this
is not the case. uint(128) would is "8001" (2 bytes) not "80" (1
byte).

There is a paragraph in the Overview (before Index) about it that is easy to skip over:

"Varints are a method of encoding integers using one or more bytes; numbers with
smaller absolute value take a smaller number of bytes. For a specification, see
http://code.google.com/apis/protocolbuffers/docs/encoding.html.";

This information should be in the description of the function.
@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 1:

Labels changed: added release-none.

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 2:

Labels changed: added repo-main, documentation.

@griesemer
Copy link
Contributor

Comment 3:

Clarified the overview section slightly.
Mentioning the varint encoding in each varint-related function only adds verbosity to
this pretty compact package. That's what the overview section is for. Also, the term
"varint" is usually reasonably well understood by itself.
https://golang.org/cl/153820044

Status changed to Started.

@gopherbot
Copy link

Comment 4:

CL https://golang.org/cl/153820044 mentions this issue.

@griesemer
Copy link
Contributor

Comment 5:

This issue was closed by revision 94f3d8c.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants