1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:24:44 -07:00

internal/lsp: change to helper.go to output a formatted file

Use format.Source before output.

Change-Id: I8504fc80defa77aeaab748b9dc65d6382da500a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/217177
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Daisuke Suzuki 2020-01-31 22:18:42 +09:00 committed by Rebecca Stambler
parent d6d1b0d853
commit 5dffee2a89

View File

@ -7,6 +7,7 @@ import (
"flag"
"fmt"
"go/ast"
"go/format"
"go/parser"
"go/token"
"log"
@ -109,7 +110,10 @@ func output() {
if err != nil {
log.Fatal(err)
}
ans := bytes.Replace(buf.Bytes(), []byte("\\\n"), []byte{}, -1)
ans, err := format.Source(bytes.Replace(buf.Bytes(), []byte("\\\n"), []byte{}, -1))
if err != nil {
log.Fatal(err)
}
fd.Write(ans)
}