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

Closed
smoyer64 opened this issue Jul 3, 2019 · 3 comments
Closed

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

smoyer64 opened this issue Jul 3, 2019 · 3 comments

Comments

@smoyer64
Copy link

smoyer64 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
@rsc
Copy link
Contributor

rsc commented Jul 16, 2019

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

@rsc
Copy link
Contributor

rsc commented Sep 25, 2019

/cc @ianthehat FYI.
Duplicate of #30058?

@rsc
Copy link
Contributor

rsc commented Oct 2, 2019

No response from @ianthehat, but I am fairly sure this is a duplicate of #30058. Closing in favor of that one.

@rsc rsc closed this as completed Oct 2, 2019
@golang golang locked and limited conversation to collaborators Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants