g% cat /tmp/x.go
package p
import (
"testing"
"rsc.io/p"
)
var (
_ = flag.String
_ testing.T
_ p.P
_ = regexp.Compile
)
g% goimports /tmp/x.go
package p
import (
"flag"
"testing"
"regexp"
"rsc.io/p"
)
var (
_ = flag.String
_ testing.T
_ p.P
_ = regexp.Compile
)
g%
The blank line between "testing" and "regexp" shouldn't be there (and then regexp should be sorted above testing). This appears to be a minimal example.