(Tested using latest version of goimports as of right now, commit golang/tools@477d3b9, go version go1.6.2 darwin/amd64.)
Given the following .go file input:
package main
import (
"encoding/binary"
// Some comment.
"fmt"
)
func main() {
fmt.Println()
}
goimports will try to remove "encoding/binary" and result in the following invalid Go code:
package main
import
// Some comment.
"fmt"
func main() {
fmt.Println()
}
It should result in valid Go code (but I don't know how it should deal with the comment, exactly).