Re:Difftastic: Syntax-aware structured diff tool
by TotempaaltJ on Thursday July 08, 2021 @07:21AM
(#27770537)
And if you do decide to do single-commit massive style changes, add the commits to an ignore revs file:
http://git-scm.com/docs/git-config#Documentation/git-config....
Re:Difftastic: Syntax-aware structured diff tool
by lpapez on Thursday July 08, 2021 @04:44PM
(#27777372)
Did not know that thing existed, super useful. Thanks a ton.
Re:Difftastic: Syntax-aware structured diff tool
by zamalek on Thursday July 08, 2021 @10:11AM
(#27772164)
> gofmt
gofmt is in a small set of formatters that disallows configuration and choice, it's also the first to my recollection. This is a feature because deciding on a coding standard is bike shedding. It's also extremely aggressive, and undoes pretty much any choice you may make in formatting your code; a feature, again.
Not all languages are this fortunate. Some have configuration (cargo fmt), others aren't aggressive enough (Roslyn).
Re:Difftastic: Syntax-aware structured diff tool
by llimllib on Thursday July 08, 2021 @10:00AM
(#27772040)
you might want to check out gofumpt too, if you haven't already: https://github.com/mvdan/gofumpt
And if you do make style changes, put them in a separate commit at the very least so the diffs are cleaner and code reviews are easier.
In my project I use gofmt (goimports) for back-end code and prettier for front-end; I've configured my editor to apply those on save, and a pre-commit hook to either run the formatter, or error if the formatting is not according to the spec.
One of Go's proverbs is "Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.". Consistency and low noise is more important (in that case) than a specific code style preference.