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

proposal: x/tools/goimports: Look for .goimportsignore in modules #32928

smoyer64 opened this issue Jul 3, 2019 · 1 comment


Copy link

commented Jul 3, 2019

As proposed in #32780, we have a recurring need to ban or blacklist certain packages within a Go module. It was pointed out in that issue that we really should be banning packages rather than try to reject certain packages as part of the dependency graph.

Since these packages most often end up in our go.mod files via the automatic organization of imports by our IDEs and editors (using gopls and/or goimports), it seems that goimports is the proper place to effect this "exclusion".

Therefore, I'm proposing that goimports looks for a .goimportsignore file local to the go.mod file if executed in a directory hosting a Go module. I realize that packages can be globally ignored via $GOPATH/.goimportsignore but there is a definite need to control this behavior on a module-by-module basis.

@gopherbot gopherbot added this to the Proposal milestone Jul 3, 2019

@gopherbot gopherbot added the Proposal label Jul 3, 2019


This comment has been minimized.

Copy link

commented Jul 16, 2019

goimports is not the only tool that consumes modules. We should solve #30058 instead of extending the .goimportsignore hack further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.