I thought I’d share this since it was a good find that some people might not know about.
I’ve tried this approach. It’s great if you don’t mind the small (but sometimes annoying) delay, and if you want to format your own contributions. But one problem is that if your are collaborating, the hooks don’t get cloned, and so the other team members may not be also doing this. You’ll be the one doing all the corrective formatting. What you thought was a one-line fix, isn’t.
But worse than not knowing if the other folks are doing this, is whether they are using the same formatting configuration. If that differs from yours, you’ll end up in a format fight with elevated churn.
There are no formatting configurations. All Go files are formatted identically; it’s a feature.
Ah, then that negates my second point. Did not know that.
I use Dart at work, which also has a formatter (though it IS configurable). We have our CI run a check to ensure the formatter has been run and the build fails otherwise. This means that master is always correctly formatted, which is nice.