vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.37k stars 2.08k forks source link

Internal Cleanup: adopt gofumpt rather than gofmt + goimports #16349

Open mattrobenolt opened 1 month ago

mattrobenolt commented 1 month ago

Feature Description

gofumpt is becoming the de-facto due to it's integration with gopls. gofumpt has a bit more strict ruleset for formatting than gofmt + goimports to more enhance consistency. And due to the integration with gopls, it's a bit easier to integrate with newer/common "format-on-save" workflows that format using gopls. gopls is currently the expected way to integrate this within VSCode, vim, Zed, etc.

gofumpt rules are effectively a superset and are entirely backwards compatible, meaning that a file formatted with gofumpt will pass both gofmt and goimports checks without additional changes, gofumpt is purely more strict.

So I believe we could replace these two tools with just gofumpt.

As an example commit of how the more strict formatting looks: https://github.com/mattrobenolt/vitess/commit/259e86bb3bb2d083e10e71048b745068fc8d2eb7

Use Case(s)

Code editors / IDEs

deepthi commented 1 month ago

Any PR that makes this change will need to include changes to

systay commented 1 month ago

I really like this idea!

We also want it backported to all supported older versions, so we don't introduce an extra cost for backports.