Edit: I see, import order can affect the order that the init()s in different packages are invoked, presumably. I stand corrected.
Edit 2: But that should not matter since the language doesn't specify any dependence on that.
The same exact argument applies. The code was broken to begin with, the implementation behavior did not break anything.
And, just like with map iteration ordering, it's very difficult/impossible for the compiler to say "hey don't depend on this!".
The only way that I can think of to get this concept (that import order in code and init() order in runtime are unrelated) is to have things break.
I suppose if the runtime randomizes things, at least you would never experience it consistently working in the first place, so maybe the issue wouldn't ever come up.
Regarding static initializers, I use them for precompiling regexps and templates, but not much more than that.
It is also incorrect to rely on the order of import initialization at all, because it's undefined, implementation specific and may change.
Undefined behavior is another thing. Surely, it's poor form to rely on undefined behavior. However, that doesn't mean it isn't possible for such a situation to arise. An accurate description of how that can happen doesn't deserve a downvote.
On the contrary, it's quite valuable for a newbie (like myself) to learn the facts, not just the dogma. Downvoting an accurate description of the behavior of the tool because you think the situation shouldn't arise in the first place is simply a misplaced use of a downvote.
It was my impression that gofmt was essentially a pretty printer. Can you point to examples where it changes semantics?