Comment #2 on issue 8729 by
shurc...@gmail.com: goimports: inserted import
Here's another reproduce case for this, without import "C" (but with 3rd
party imports; I couldn't reproduce it with standard library imports only).
package u9
import (
)
// AddTabSupport is a helper that modifies a <textarea>, so that pressing
tab key will insert tabs.
func AddTabSupport(textArea *dom.HTMLTextAreaElement) {
var ke *dom.KeyboardEvent
inputEvent := js.Global.Get("CustomEvent").New("input")
}
Actual output after running goimports:
package u9
import (
"
github.com/gopherjs/gopherjs/js"
// AddTabSupport is a helper that modifies a <textarea>, so that pressing
tab key will insert tabs.
"
honnef.co/go/js/dom"
)
func AddTabSupport(textArea *dom.HTMLTextAreaElement) {
var ke *dom.KeyboardEvent
_ = js.Global
}
Note that the "// AddTabSupport ..." comment moved.
Expected output:
package u9
import (
"
github.com/gopherjs/gopherjs/js"
"
honnef.co/go/js/dom"
)
// AddTabSupport is a helper that modifies a <textarea>, so that pressing
tab key will insert tabs.
func AddTabSupport(textArea *dom.HTMLTextAreaElement) {
var ke *dom.KeyboardEvent
_ = js.Global
}
(It requires having those 2 packages in GOPATH.)