diff options
Diffstat (limited to 'libgo/go/cmd/gofmt/testdata/import.golden')
-rw-r--r-- | libgo/go/cmd/gofmt/testdata/import.golden | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/libgo/go/cmd/gofmt/testdata/import.golden b/libgo/go/cmd/gofmt/testdata/import.golden index 29bdc9baf4a..1125b70cb76 100644 --- a/libgo/go/cmd/gofmt/testdata/import.golden +++ b/libgo/go/cmd/gofmt/testdata/import.golden @@ -1,3 +1,4 @@ +// package comment package main import ( @@ -10,11 +11,6 @@ import ( import ( "fmt" - "math" -) - -import ( - "fmt" "math" @@ -25,6 +21,10 @@ import ( "io" ) +// We reset the line numbering to test that +// the formatting works independent of line directives +//line :19 + import ( "errors" "fmt" @@ -129,3 +129,66 @@ import ( "dedup_by_group" ) + +import ( + "fmt" // for Printf + /* comment */ io1 "io" + /* comment */ io2 "io" + /* comment */ "log" +) + +import ( + "fmt" + /* comment */ io1 "io" + /* comment */ io2 "io" // hello + "math" /* right side */ + // end +) + +import ( + "errors" // for New + "fmt" + /* comment */ io1 "io" /* before */ // after + io2 "io" // another + // end +) + +import ( + "errors" // for New + /* left */ "fmt" /* right */ + "log" // for Fatal + /* left */ "math" /* right */ +) + +import /* why */ /* comment here? */ ( + /* comment */ "fmt" + "math" +) + +// Reset it again +//line :100 + +// Dedup with different import styles +import ( + "path" + . "path" + _ "path" + pathpkg "path" +) + +/* comment */ +import ( + "fmt" + "math" // for Abs + // This is a new run + "errors" + "fmt" +) + +// End an import declaration in the same line +// as the last import. See golang.org/issue/33538. +// Note: Must be the last (or 2nd last) line of the file. +import ( + "fmt" + "math" +) |