go/src/cmd/gofmt/testdata
Agniva De Sarker 5b68cb65d3 go/ast: fix SortImports to handle block comments
The current algorithm only assumed line comments which always
appear at the end of an import spec. This caused block comments
which can appear before a spec to be attached to the previous spec.

So while mapping a comment to an import spec, we maintain additional
information on whether the comment is supposed to appear on the left
or right of the spec.

And we also take into account the possibility of "//line" comments
in the source. So we use unadjusted line numbers.

While at it, added some more testcases from tools/go/ast/astutil/imports_test.go

Fixes #18929

Change-Id: If920426641702a8a93904b2ec1d3455749169f69
Reviewed-on: https://go-review.googlesource.com/c/go/+/162337
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-03-28 23:49:52 +00:00
..
comments.golden
comments.input
composites.golden
composites.input
crlf.golden
crlf.input
emptydecl.golden
emptydecl.input
go2numbers.golden cmd/gofmt: normalize integer imaginary literals starting with 0 2019-02-19 20:38:06 +00:00
go2numbers.input cmd/gofmt: normalize integer imaginary literals starting with 0 2019-02-19 20:38:06 +00:00
import.golden go/ast: fix SortImports to handle block comments 2019-03-28 23:49:52 +00:00
import.input go/ast: fix SortImports to handle block comments 2019-03-28 23:49:52 +00:00
ranges.golden
ranges.input
rewrite1.golden
rewrite1.input
rewrite2.golden
rewrite2.input
rewrite3.golden
rewrite3.input
rewrite4.golden
rewrite4.input
rewrite5.golden
rewrite5.input
rewrite6.golden
rewrite6.input
rewrite7.golden
rewrite7.input
rewrite8.golden
rewrite8.input
rewrite9.golden
rewrite9.input
slices1.golden
slices1.input
stdin1.golden
stdin1.input
stdin2.golden
stdin2.input
stdin3.golden
stdin3.input
stdin4.golden
stdin4.input
stdin5.golden
stdin5.input
stdin6.golden
stdin6.input
stdin7.golden
stdin7.input
typealias.golden
typealias.input
typeswitch.golden
typeswitch.input