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:
parent
5a00de994c
commit
a8570e12b6
|
@ -1,6 +1,7 @@
|
||||||
package source
|
package source
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/ast"
|
"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 {
|
if items, ok := complit(path, pos, pkg, info, found); ok {
|
||||||
return items, "", nil
|
return items, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch n := path[0].(type) {
|
switch n := path[0].(type) {
|
||||||
case *ast.Ident:
|
case *ast.Ident:
|
||||||
// Set the filter prefix.
|
// 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.
|
// formatParams correctly format the parameters of a function.
|
||||||
func formatParams(t *types.Tuple, variadic bool, qualifier types.Qualifier) string {
|
func formatParams(t *types.Tuple, variadic bool, qualifier types.Qualifier) string {
|
||||||
var b strings.Builder
|
var b bytes.Buffer
|
||||||
b.WriteByte('(')
|
b.WriteByte('(')
|
||||||
for i := 0; i < t.Len(); i++ {
|
for i := 0; i < t.Len(); i++ {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
|
|
Loading…
Reference in New Issue