Go: strings: please improve documentation for strings.Builder

Created on 17 Nov 2017  ·  7Comments  ·  Source: golang/go

I think that the documentation of strings.Builder could be improved by adding a few sentences that compare it to bytes.Buffer. More exactly, I'd like to see:

  • a pointer to bytes.Buffer;
  • a list of the methods that strings.Builder is lacking as compared to bytes.Buffer.
Documentation FrozenDueToAge NeedsFix help wanted

All 7 comments

We could do the first bullet, but I don't want to do the second bullet. That seems too verbose for its utility.

Change https://golang.org/cl/78696 mentions this issue: strings: Add a note on bytes.Buffer

You could at least mention that Builder lacks the Bytes method, which is the main point as far as I understand.

I have read through the relevant discussions/changes/sources and would be happy to help improve the docs for strings.Builder. May I be assigned to this issue?

@MateusAmin, just send a change if you have one. We rarely use the GitHub assignee feature.

@bradfitz maybe it would make sense instead to put a note in bytes.Buffer that if you want to construct a string, using strings.Builder might be more efficient?

Change https://golang.org/cl/80815 mentions this issue: bytes: mention strings.Builder in Buffer.String docs

Was this page helpful?
0 / 5 - 0 ratings