Skip to content

Commit

Permalink
Merge pull request #1643 from xushiwei/ov
Browse files Browse the repository at this point in the history
gop fmt .gox bugfix
  • Loading branch information
xushiwei committed Jan 19, 2024
2 parents d2f6661 + b639f99 commit 4ea9247
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions parser/_testdata/goxtest2/bar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var (
x.App
)
15 changes: 15 additions & 0 deletions parser/_testdata/goxtest2/parser.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

file bar.gox
ast.GenDecl:
Tok: var
Specs:
ast.ValueSpec:
Type:
ast.SelectorExpr:
X:
ast.Ident:
Name: x
Sel:
ast.Ident:
Name: App
3 changes: 1 addition & 2 deletions printer/gop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package printer_test
import (
"bytes"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -114,7 +113,7 @@ func testFrom(t *testing.T, fpath, sel string, mode int) {
if sel != "" && !strings.Contains(fpath, sel) {
return
}
src, err := ioutil.ReadFile(fpath)
src, err := os.ReadFile(fpath)
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 3 additions & 1 deletion printer/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,9 @@ func (p *printer) spec(spec ast.Spec, n int, doIndent bool) {
p.setComment(s.Doc)
p.identList(s.Names, doIndent) // always present
if s.Type != nil {
p.print(blank)
if len(s.Names) > 0 {
p.print(blank)
}
p.expr(s.Type)
}
if s.Values != nil {
Expand Down

0 comments on commit 4ea9247

Please sign in to comment.