3 ms·
I massively agree with tools like black and gofmt. "Gofmt's style is no one's favorite, yet gofmt is everyone's favorite." We need more of the same, I really
by theshrike79 1y ago
I massively agree with tools like black and gofmt.
"Gofmt's style is no one's favorite, yet gofmt is everyone's favorite."
We need more of the same, I really wish C# had a similar opinionated tool I could use to bring dozens of company projects in line.
Something that can be run locally and in CI and has ZERO configuration, it just enforces a static style with no possibility of bikeshedding.
- camgunz 1y agoTo everyone's detriment, gofmt doesn't wrap lines. That's why--combined with the truly evil entrenchment of tabs--lines in Go code tend to be ridiculously long. I'm not saying it's an easy problem (my info comes from Bob Nystrom's post [0] on it), but I do think it's table stakes for a formatter. [0]: https://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/ https://journal.stuffwithstuff.com/2015/09/08/the-hardest-pr...
- xenophonf 1y agoThe "no possibility of bikeshedding" thing is critical. I like things formatted the way I format them, but the thought of having to specify and then justify and worse enforce each and every little decision just completely saps any desire I have to do any of it. Black (and isort) are huge productivity boosters. Run and done. Plus, relying on shared tools like that instead of whatever the editor does means I can hang on to Emacs for that much longer while letting other folks use whatever garbage editor they want.
- tzs 1y agoDoesn't zero configuration just shift the bikeshedding from how to configure the formatting tool to which zero configuration formatting tool to use? I'd go for the opposite. Find a highly configurable formatting tool and standardize on a particular configuration for code in your repo, and enforce this format when code is checked in. Provide some scripts or wrappers or hooks (whatever is best for the source code control system you are using) that can on checkout automatically run that formatting tool but with a configuration supplied by the user instead of company standard configuration.
- theshrike79 1y agoIf you have a reliable way to get 100+ experienced programmers agree on a single style company-wide, please share =) With a tool like black, taking it into use is a binary selection of yes/no. Just fiddling with an .editorconfig (https://editorconfig.org https://editorconfig.org) setup for a single project can take WEEKS to decide what bits to flip in which position