-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to disable imports processing #308
Comments
gci and gofumpt overlap quite a lot in terms of wanting to be in control of how imports are grouped. They seem to have different goals as well. Why would you use both at the same time? I don't plan on adding options to disable some of gofumpt's features. Just like gofmt, the tool becomes less useful the more options it gains, as it loses consistency. If there is something in particular about import grouping that you think gci does better than gofumpt, I'm happy to consider it as a feature request. Or if gci makes any reasonable change that gofumpt later undoes, I'm also open to looking into that as a potential bug. Aside from those two options, I don't see the point in ensuring that gofumpt can be used together with gci. |
gci formats only imports, and is great at that. gofumpt does a lot of other things gci doesn't and is great at them, but its import formatting is much more limited than gci's. Therefore as it stands, it makes perfect sense to me to want to use both of the tools. Now, if gofumpt would grow some more abilities in the import sorting/grouping area, I certainly wouldn't mind. gofumpt might do a lot of the following already, but for my taste, the ability to do three groups with one empty line between each, and each group sorted internally alphabetically, would be fine: 1) stdlib, 2) 3rd party (everything that's not stdlib or "local", 3) "local". Alias, dot, and default imports I don't have a particular opinion about as long as they're sorted consistently within their respective group. Maybe all at the beginning or at the end of the group, also sorted by the module path. For the definition of "local", see https://github.com/daixiang0/gci#gci and https://github.com/daixiang0/gci#localmodule The above is just my preference though (even if I believe it is a fairly common one). |
Could an option to disable gofumpt's processing of imports be added?
This one (given compatible formatter configs) is quite likely a golangci-lint bug that should be fixed there. But it can be that a user wants to use let's say a gci config that differs from gofumpt's opinion on imports, but wants to use both it and gofumpt because both are great at what they do, and there's nothing golangci-lint could do about that. Even if there would be no formatting conflicts, the formatting done by gofumpt would be redundant for cases where another import formatter is in use.
An option to disable gofumpt's import processing would help with both of the above.
The text was updated successfully, but these errors were encountered: