Skip to content
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

Import statements in golang should be ignored #365

Open
ptxmac opened this issue Jul 28, 2021 · 1 comment
Open

Import statements in golang should be ignored #365

ptxmac opened this issue Jul 28, 2021 · 1 comment
Assignees

Comments

@ptxmac
Copy link

ptxmac commented Jul 28, 2021

I often get warnings in my golang projects that my import blocks are duplicates and should be refactored. Unfortunately, that's not how golang works - everything a file references must be imported, there are no transitive imports.

A codeblock like:

package mypackage 

import (
   "fmt"
    "anotherpackage"
)

Will often occur in many files and the only way to get rid of duplication would be to put everything in one file which is a horrible way to improve maintainability

@awiecek
Copy link

awiecek commented Dec 6, 2021

Having the same issue, I noticed there is a piece of code that is supposed to do this but apparently it does not work as expected:

"(GenDecl _ (specs (ImportSpec ___)) _)",

I tried to come up with my own filter but with no success - is there a known workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants