3 ms·
I didn't really understand this until I started using golang. Now I don't want to go back to other languages and have to deal with varying syntaxes and manually
by andrewzah 7y ago
I didn't really understand this until I started using golang. Now I don't want to go back to other languages and have to deal with varying syntaxes and manually running a formatter.
- thedance 7y agoWhat's a language that lacks such a facility? ClangFormat covers C/C++/Java/JavaScript/Objective-C/Protobuf/C#. gofmt obviously can do Go. buildifier will rewrite your Bazel BUILD files.
- frosted-flakes 7y agoThose aren't highly opionated default formatters though. The JavaScript community seems to have settled on Prettier as the go-to formatter, but not everyone uses it, and even Prettier had to add a bunch of options for certain things that will always be highly personal. Stuff like trailing commas, tabs vs spaces (and how many spaces‽), line lengths, and semicolons.
- klodolph 7y agoWell, one part of trailing commas in Prettier is that different versions of JavaScript support them in different places. With go fmt, the formatter is updated in lockstep with the language.
- pje 7y agoruby
- andrewzah 7y agoruby has rubocop, although it is more basic.