I agree gofmt is amazing, and for any language I'd happily trade whatever my personal style is for consistency and and gofmt-like tool.
Can gofmt really change semantics? I would assume that's a bug?
It is definitely not supposed to change semantics. If you ever see an instance of that, then it is a big fat bug and should be reported to the developers ASAP.
I doubt you'll see such a bug though. The language is designed to be easy for a computer to parse.
The "standard" alternative (e.g. the google c++ style guide) advises 2-space indentation with 80 column lines. That specific format works well with almost every tool in existence. Tabs, not so much.
You can google "jwz tabs" to get a more in depth discussion. It's not a "big" deal, and as noted, in many ways it's better to standardize on the "wrong" decision than to constantly hash it out over formatting sugar.
I use emacs and various command line tools. Tabs don't give me problems. FWIW.
It was my impression that gofmt was essentially a pretty printer. Can you point to examples where it changes semantics?
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.