Hacker News new | ask | show | jobs
by pointytrees 3186 days ago
I sometimes feel crummy to force my preferences on other developers I bring on board. For example, most of my work is PHP, so all of our repo's use spaces, and braces on newlines. When a new dev comes on board, they must follow that format. Funny thing is with GO, I don't mind in the slightest that go fmt . is tabs and braces on the same line. What is so much more important to me is consistency. Go has done a stellar job at providing consistency. As I read when I was getting started, no one loves gofmt's formatting, but everyone loves gofmt.
1 comments

I have mixed feelings about the language itself, and some of its tooling (GOPATH just makes no sense to me whatsoever, and I've not spent enough time hacking Go projects to understand why it wouldn't be better to just have something like Cargo to handle dependencies), but I firmly believe that go fmt might be the biggest contribution to the language tooling world I've seen for a long time.

We've had autoformatters before, but they were always customisable things, sparsely used. Go shipping a formatter with the core distribution? Go projects routinely adopting it as a requirement for contributors? One standard format defined from the start?

Knockdown stuff. All those pointless arguments about coding style, gone. All that worrying about how to lay things out, gone. Just run go fmt and move on.

I have now become entirely reliant on rustfmt when I'm writing Rust, and I love it. I just write a total horrible mess, press save and it magically becomes neat and lovely.

I wish I had something that powerful operating in my C# environment at work.

Admittedly, at the moment I also wish my C# environment at work wasn't laden with iron-clad layout rules that the tooling isn't capable of fixing for me. All private members must be after the public ones, but static private ones need to be before the instance ones, and all properties go first regardless of accessibility (although remember the private properties have to go after the public properties). And usings must go inside the namespace definition, in alphabetical order except System.whatever, which all come first (in alphabetical order). And you can't split a function argument across multiple lines unless it's a lambda. Microsoft's C# style guide? What's that and why would we care and no it's not prescriptive enough anyway.

It's enough to make your head spin. Good thing I'm only there for six more days.

Give every language a formatter, as standard, and let's just be done with it.