]> Cypherpunks repositories - gostls13.git/commitdiff
go/doc: using strings.Builder
authorcuiweixie <cuiweixie@gmail.com>
Fri, 2 Sep 2022 23:09:54 +0000 (07:09 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 6 Sep 2022 21:50:52 +0000 (21:50 +0000)
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>
src/go/doc/headscan.go

index f55ca754a65f3d24277a66d003d0070b11c2c38a..82f5fed1ce008bed8916ca7ec2bfa20a838ac0b5 100644 (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)