Hacker News new | ask | show | jobs
by justinrubek 268 days ago
Format on save is my worst enemy. It may work fine for go, but you'll eventually run into code where it isn't formatted using the one your editor is configured for. Then, you end up formatting the whole file or having to remember how to disable save formatting. I check formatting as a git hook on commits instead.
1 comments

If you’re checking it on git hooks then it’s even safer to have format on save. Personally I default to format on save, and if I’m making a small edit to a file that is formatted differently, and it would cause a messy commit to format on save, then I simply “undo” and then “save without formatting” in the VSCode command palette.
We have format commits so that we have separate non-logic commits that don't have to be aggravated over if we find files are all off.
You can also add those non-logic commits to a .git-blame-ignore-revs file, and any client that supports it will ignore those commits when surfacing git blame annotations. I believe GitHub supports this but not sure. I think VSCode does…