mirror of
https://github.com/golang/go
synced 2024-11-18 10:44:45 -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:
parent
d6d1b0d853
commit
5dffee2a89
@ -7,6 +7,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/ast"
|
"go/ast"
|
||||||
|
"go/format"
|
||||||
"go/parser"
|
"go/parser"
|
||||||
"go/token"
|
"go/token"
|
||||||
"log"
|
"log"
|
||||||
@ -109,7 +110,10 @@ func output() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
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)
|
fd.Write(ans)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user