Re:A JavaScript parser and interpreter written in Go
by agentS on Thursday November 28, 2013 @03:12AM
(#6813568)
Note that gofmt sorts within groups. So if you leave spaces between groups of imports, it'll sort them all separately. Presumably, this sort of grouping is the reason it does it this way.
Re:A JavaScript parser and interpreter written in Go
by codebeaker on Thursday November 28, 2013 @03:27AM
(#6813612)
It's possible that if you have packages that understand flags (config package, with flags in init(), for example) that if you include it after the testing package, or before. One of them won't accept flags. (because flag.Parse() has already been called)
Re:A JavaScript parser and interpreter written in Go
by 1631- on Thursday November 28, 2013 @12:00PM
(#6815314)
You can't rely on the order of imports initialization anyway. See http://golang.org/ref/spec#Program_execution .. I believe that's also the reason, you shouldn't call `flag.Parse()` in `init()`
Since gofmt sorts imports, the grouping is soon undone.
In any case, it is quite easy to distinguish the three kinds of imports if local imports share a common prefix or set of prefixes.
Am I missing something here?