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

internal/lsp: do not log failed suggested fix for fillstruct to stderr

Avoid logging to stderr as it will interfere with LSP communication.

Change-Id: Ic9ff4f3555eabb8b0b6503650df7de5ddb76ef98
Reviewed-on: https://go-review.googlesource.com/c/tools/+/249997
Run-TryBot: Pontus Leitzler <leitzler@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Pontus Leitzler 2020-08-22 18:35:00 +02:00 committed by Robert Findley
parent 1e23e48ab9
commit 307de81be3

View File

@ -13,7 +13,6 @@ import (
"go/format"
"go/token"
"go/types"
"log"
"unicode"
"golang.org/x/tools/go/analysis"
@ -254,8 +253,7 @@ func SuggestedFix(fset *token.FileSet, rng span.Range, content []byte, file *ast
var newExpr bytes.Buffer
if err := format.Node(&newExpr, fakeFset, cl); err != nil {
log.Printf("failed to format %s: %v", cl.Type, err)
return nil, err
return nil, fmt.Errorf("failed to format %s: %v", cl.Type, err)
}
split = bytes.Split(newExpr.Bytes(), []byte("\n"))
newText := bytes.NewBuffer(nil)