-
I'm just finding out gofumptports is no longer a thing. Is there any solution to get that same functionality built into the gofumpt command? I found the changelog entry a little lacking around a way forward. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Could you please explain what you want to use gofumports for? As for the more detailed historical background - I didn't want to write lots in the release notes, because I felt like that would be too verbose. The reason it was created was for IDEs years ago, before gopls was a thing. Most IDEs just allowed swapping "gofmt on save" with a different tool, like goimports. So, if you wanted to get goimports plus gofumpt, you couldn't really. That's why I created a horrible hack: a merge of the two into a single tool. It was a horrible hack, though, and always meant as a temporary solution. It meant copying many more tens of thousands of lines of code, it made the project harder to maintain and test, and I ended up publishing two tools when in fact I only really want to publish one. Nowadays, pretty much every editor with good support for Go integrates with gopls. There are some exceptions, like GoLand, but they're doing their own custom thing anyway. For example, using goimports with GoLand makes no sense, because they implemented their own system to fix up package imports. And gopls has all the features that goimports used to have, in a better way - since it's a server, it can cache more information and do the work faster. Similarly, it also integrates with gofumpt directly, even though it's turned off by default. So, as far as I can tell, there should generally be no more reason to want to use goimports and gofumpt at the same time. If someone really wants to do that, they could still run one tool after another, and that should work. |
Beta Was this translation helpful? Give feedback.
-
I use gofumpt as a preprocessor for Kdiff3. It would be great if that compbination of gofumpt and goimports worked out of the box. |
Beta Was this translation helpful? Give feedback.
Could you please explain what you want to use gofumports for?
As for the more detailed historical background - I didn't want to write lots in the release notes, because I felt like that would be too verbose.
The reason it was created was for IDEs years ago, before gopls was a thing. Most IDEs just allowed swapping "gofmt on save" with a different tool, like goimports. So, if you wanted to get goimports plus gofumpt, you couldn't really. That's why I created a horrible hack: a merge of the two into a single tool.
It was a horrible hack, though, and always meant as a temporary solution. It meant copying many more tens of thousands of lines of code, it made the project harder to maintain and…