You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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"
)
funcmain() {
fmt.Println()
}
goimports will try to remove "encoding/binary" and result in the following invalid Go code:
package main
import// Some comment."fmt"funcmain() {
fmt.Println()
}
It should result in valid Go code (but I don't know how it should deal with the comment, exactly).
The text was updated successfully, but these errors were encountered:
dmitshur
changed the title
x/tools/cmd/goimports: Removing an unused import path can mangle comments.
x/tools/cmd/goimports: Removing an unused import path with comments can produce invalid Go code.
Apr 25, 2016
(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:
goimports
will try to remove "encoding/binary" and result in the following invalid Go code:It should result in valid Go code (but I don't know how it should deal with the comment, exactly).
The text was updated successfully, but these errors were encountered: