]> Cypherpunks repositories - gostls13.git/commit
cmd/gofmt: sort more, remove some duplicate imports
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 6 Sep 2013 20:25:15 +0000 (16:25 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 6 Sep 2013 20:25:15 +0000 (16:25 -0400)
commit08925ce6ee16be5a3b937c0d55c2548bf30c5776
treeec42fcf8e511063f30760bb8cdc94c759450be0c
parent17e5539f7d3e17e3c585b3c4e6d4448d7f953626
cmd/gofmt: sort more, remove some duplicate imports

* Sort imports by import path, then import name, then comment. Currently, gofmt sorts only by import path.
* If two imports have the same import path and import name, and one of them has no comment, remove the import with no comment. (See the discussion at issue 4414.)

Based on @rsc's https://golang.org/cl/7231070/

Fixes #4414.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/12837044
src/cmd/gofmt/testdata/import.golden
src/cmd/gofmt/testdata/import.input
src/pkg/go/ast/import.go
src/pkg/go/token/position.go