1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

internal/lsp: use bytes.Buffer instead of strings.Builder

x/tools only supports Go 1.10 and Go 1.11, but it's such a simple fix to
support 1.9, so change from strings.Builder to bytes.Buffer.

Change-Id: Ie37d6c7da7ce7dbbd4e9ec933e1eff3304142a59
Reviewed-on: https://go-review.googlesource.com/c/149178
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2018-11-12 17:37:20 -05:00
parent 5a00de994c
commit a8570e12b6

View File

@ -1,6 +1,7 @@
package source
import (
"bytes"
"context"
"fmt"
"go/ast"
@ -105,7 +106,6 @@ func completions(file *ast.File, pos token.Pos, fset *token.FileSet, pkg *types.
if items, ok := complit(path, pos, pkg, info, found); ok {
return items, "", nil
}
switch n := path[0].(type) {
case *ast.Ident:
// Set the filter prefix.
@ -440,7 +440,7 @@ func formatType(typ types.Type, qualifier types.Qualifier) (detail string, kind
// formatParams correctly format the parameters of a function.
func formatParams(t *types.Tuple, variadic bool, qualifier types.Qualifier) string {
var b strings.Builder
var b bytes.Buffer
b.WriteByte('(')
for i := 0; i < t.Len(); i++ {
if i > 0 {