-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add prefix-current-module
to goimports
#931
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
Comments
Thank you for idea, seems reasonable. |
@ernado are you aware of any tools that detect module paths in GolangCI? If not, I would pull in https://github.com/gobuffalo/here as a dependency. It doesn't have any additional dependencies that's not already a dependency in GolangCI. |
I think that package name should be already in analysis context, but I'm not sure. |
The package name is not enough, I need the root module path and as far as I can tell, it's not available in the context. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sadly, I haven't beeb able to work on it, but it'd still be a good feature. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The problem can be solved with linters:
enable:
- gci
linters-settings:
gci:
sections:
- standard
- default
- localmodule |
I'd like to add a bool option
prefix-current-module
to the goimports config.It would basically check if the linted package is a module, and slap the module path (based on
go.mod
if exists) to the list of local prefixes. It would make the configuration more portable.WDYT?
The text was updated successfully, but these errors were encountered: