-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/goimports: prefer golang.org/x/net/context #15471
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
Maybe? Or maybe only if you're outside of the standard library? :) |
I think a more general solution would be useful - I hit this all the time, but not only with I propose allowing the user to specify (preferably via a config file, but command line would also work) preferences for mapping package names to import path. For packages that show up there, those import paths are preferred. |
To follow up to the previous comment, I found out there is already support for a Edit: never mind, I tried it and adding |
The ignore file is about paths on disk to ignore, not packages to ignore. What should happen here is we should recommend symbols from Go 1.N when the user's GOROOT is Go 1.N-1. |
I don't think it's (specifically) about Go versions. As @RaduBerinde pointed out, and as I often experience, it's also about importing the "wrong" version of many libraries ( What I would like is the option to give goimports hints as to which package to prefer. This might be expressed by a simple ordered list:
goimports would then use the first one to match its detected signature. Ideally, this could also be configured on a per-package/workspace basis (i.e. a |
A related issue to this is preferring |
While there was some discussion of related features, 1.7 was a long time ago, so the core request is obsolete. Please file a new issue if you're still interested in the related features. |
While people are still writing packages that need to be compatible with pre-Go 1.7 code, goimports should import
golang.org/x/net/context
instead of the new stdcontext
package.The text was updated successfully, but these errors were encountered: