1
0
mirror of https://github.com/golang/go synced 2024-11-27 02:01:23 -07:00

go/doc: using strings.Builder

Change-Id: I9658c37a548a386c57d83dc13d5e9925a9c13211
Reviewed-on: https://go-review.googlesource.com/c/go/+/428140
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
cuiweixie 2022-09-03 07:09:54 +08:00 committed by Gopher Robot
parent a8237ba61a
commit 11c5bf521e

View File

@ -16,7 +16,6 @@ By default, the $GOROOT/src directory is scanned.
package main
import (
"bytes"
"flag"
"fmt"
"go/doc"
@ -46,7 +45,7 @@ func isGoFile(fi fs.FileInfo) bool {
}
func appendHeadings(list []string, comment string) []string {
var buf bytes.Buffer
var buf strings.Builder
doc.ToHTML(&buf, comment, nil)
for s := buf.String(); s != ""; {
loc := html_h.FindStringIndex(s)