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
cmd/go: provide way to disable use of alias #7453
Labels
Milestone
Comments
https://groups.google.com/forum/#!topic/golang-dev/RgHGBXROeAw |
An alternative solution is to use a special package. For example, include in your repository an import.go file with: package importPath import _ "rsc.io/pdf" When go get finds an importPath package, it checks that it has a single import whose path matches with the one defined by the directory name (or, alternatively, that the imported url doesn't resolve to it, as initially proposed by rsc in golang-dev). The go tool would otherwise ignore importPath packages, which would never be built. I think this approach has several advantages: - It doesn't require any change to the language or the compiler. - It is unlikely that additional info will creep into the import.go file (as with a .json file). - Vendoring becomes a matter of only rewriting import paths (current tools already work with no changes!). - This same method could be extended to support more than one import path, although I'm not sure we would want to do that. One drawback that I see is that godoc would also need to be aware of importPath packages, but it won't be more difficult than making it understand the modified package clause. By the way, the importPath name is of course arbitrary. I'm sure there will be some better option. My point is that it is easy to avoid conflicts with existing package names (something like Path or ROOT would also work, there are more radical solutions such as "package ." or "package import" which I find less appealing because they would require a language change). |
CL https://golang.org/cl/124940043 mentions this issue. |
This issue was closed by revision 0c61467. Status changed to Fixed. |
CL https://golang.org/cl/127210043 mentions this issue. |
This issue was closed by revision 3763a39. |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
See golang.org/s/go14customimport for design. Added case to deps_test to allow go/build to import regexp. Not a new dependency, because go/build already imports go/doc which imports regexp. Fixes golang#7453. LGTM=r R=r, josharian CC=golang-codereviews https://golang.org/cl/124940043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
Fixes golang#7453. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/127210043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
See golang.org/s/go14customimport for design. Added case to deps_test to allow go/build to import regexp. Not a new dependency, because go/build already imports go/doc which imports regexp. Fixes golang#7453. LGTM=r R=r, josharian CC=golang-codereviews https://golang.org/cl/124940043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
Fixes golang#7453. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/127210043
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: