Skip to content

Commit

Permalink
remove unintentional debug prints
Browse files Browse the repository at this point in the history
These were introduced when syncing gofumpt with gofmt from Go 1.18rc1.
I didn't notice partially because our tests weren't strict enough;
fix that as well.

While here, gofumpt our own source code.
  • Loading branch information
mvdan committed Mar 18, 2022
1 parent edc2d69 commit 9eee203
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,6 @@ func (f *fumpter) joinStdImports(d *ast.GenDecl) {
periodIndex := strings.IndexByte(path, '.')
slashIndex := strings.IndexByte(path, '/')
switch {

// Imports with a period in the first path element are third party.
// Note that this includes "foo.com" and excludes "foo/bar.com/baz".
case periodIndex > 0 && (slashIndex == -1 || periodIndex < slashIndex),
Expand Down
2 changes: 0 additions & 2 deletions gofmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,7 @@ func gofmtMain(s *sequencer) {
case !info.IsDir():
// Non-directory arguments are always formatted.
arg := arg
println(arg)
s.Add(fileWeight(arg, info), func(r *reporter) error {
println(arg)
return processFile(arg, info, nil, r, true)
})
default:
Expand Down
10 changes: 7 additions & 3 deletions testdata/scripts/ignore-implicit-vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ cp orig.go.golden vendor/foo/foo.go

# format explicit vendor dir
gofumpt -l vendor
stdout 'vendor[/\\]foo[/\\]foo.go'
stdout -count=1 'vendor[/\\]foo[/\\]foo.go'
! stderr .

# format explicit vendor file
gofumpt -l vendor/foo/foo.go
stdout 'vendor[/\\]foo[/\\]foo.go'
stdout -count=1 'vendor[/\\]foo[/\\]foo.go'
! stderr .

# ignore implicit vendor call
gofumpt -l .
! stdout .
! stderr .

# format explicit vendor pkg while ignoring rest
mkdir vendor/ignore
cp orig.go.golden vendor/ignore/ignore.go
gofumpt -l vendor/foo .
stdout 'vendor[/\\]foo[/\\]foo.go'
stdout -count=1 'vendor[/\\]foo[/\\]foo.go'
! stderr .

-- orig.go.golden --
package p
Expand Down

0 comments on commit 9eee203

Please sign in to comment.