There is a fundamental difference between inserting importstatements and inserting commas: goimports works on
syntactically *correct* code and tries to make it semantically
meaningful by inserting appropriate import statements so that
the syntactical correct time.Second becomes semantically
sensible.
Inserting commas would have to work on a *syntactically*
*malformed* code which cannot be parsed by standard means.
Such stuff is tricky to impossible. Your example looks innocent,
but where would you insert commas in this parameter list:
func f(foo bar waz det zup) int
If waz and zup are types than this might be f(foo, bar waz, det zup)
if only zup is a type it presumably means f(foo, bar, waz, det zup).
Now what if both bar and waz are types? Applying some heuristics
her will produce more confusion than requiring everybody to type
some commas.
V.