Skip to content

Commit

Permalink
add test that repros the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump committed Feb 24, 2022
1 parent 86d648d commit b934371
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions internal/imports/fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,37 @@ var _, _, _, _, _ = fmt.Errorf, io.Copy, strings.Contains, renamed_packagea.A, B
`,
},

// Blank line can be added even when first import of group has comment with quote
{
name: "new_section_where_trailing_comment_has_quote",
in: `package main
import (
"context"
bar "local.com/bar"
baz "local.com/baz"
buzz "local.com/buzz"
"github.com/golang/snappy" // this is a "typical" import
)
var _, _, _, _, _ = context.Background, bar.B, baz.B, buzz.B, snappy.ErrCorrupt
`,
out: `package main
import (
"context"
"github.com/golang/snappy" // this is a "typical" import
bar "local.com/bar"
baz "local.com/baz"
buzz "local.com/buzz"
)
var _, _, _, _, _ = context.Background, bar.B, baz.B, buzz.B, snappy.ErrCorrupt
`,
},

// Non-idempotent comment formatting
// golang.org/issue/8035
{
Expand Down

0 comments on commit b934371

Please sign in to comment.