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
go/build: honour GO15VENDOREXPERIMENT #12278
Comments
Yes, this needs to happen. Now that my projects are also using vendor directories, I've also been running into this. /cc @adg @Sajmani @josharian |
I also have issues with oracle and GO15VENDOREXPERIMENT and Is this correct place to raise an issue for oracle? If so should I open a new one, or report in this one? Thanks, Eddy |
@ereyes01 Assuming you are talking about x/tools/cmd/oracle, then filing an issue on this issue tracker is the right thing to do. This particular issue is about goimports. |
Shouldn't the functionality be integrated into go/build so
that every tool that uses go/build will automatically
handle the vendor experiment?
|
@minux, this is what I've been trying to get my head around the last few days. Tools like goimports and gocode would need a significant refactor and very temporary workaround to implement support for the vendor experiment. Is there a reason that the vendor experiment was implemented only in the go tool rather than in go/build? |
@rsc, Is it possible and even worth it at this point to move the vendor functionality from cmd/go to go/build to enable third party tools to piggy back on the existing vendor functionality? |
On Sep 4, 2015 11:29 AM, "Kyle Wolfe" notifications@github.com wrote:
One issue is that the new go/build package will only be available in Go |
Could this be put onto a near-term milestone? (1.6?) I'm happily using the new vendoring mechanism and not having these source manipulation tools at our disposal is unfortunate. I'm also happy to have a crack at doing something if there is a consensus about what is a reasonable approach to fix it. Waiting until 1.6 is annoying, but waiting until after 1.6 would be worse. |
Goimports is not distributed with Go so we don't use the Go 1.N milestones for it. This can be fixed whenever. |
For example, goimports uses go/build here: https://github.com/golang/tools/blob/5a90b2958f12ca0f046ffe2eb1523c5896af5dae/imports/fix.go#L158 - which implies either the stdlib needs fixing or the whole importing logic needs to move out of the stdlib. |
I modified this issue to track specifically the issue of go/build support
for the vendoring experiment.
As the vendoring experiment is going to be enabled by default in Go 1.6,
I think go/build support is also in order.
Label this Go1.6Early.
Once this is done, we can vendor the go/build package temporarily
into x/tools so that gorename/goimports could benefit Go 1.5 users.
|
Ping. I note that the 1.6Early deadline (according to the github milestone) is October the 31st, which is now ~12 days away. Is this issue on anybody's list, and is there anything I can do to help? Has the deadline already been missed, so to say? I would really like to be able to use |
The deadline hasn't been missed. On 19 October 2015 at 21:39, Peter Waller notifications@github.com wrote:
|
Me too! Waiting to be able to pass all these awesome linters with the vendors' code instead of the global one. |
Many people want this. No need to enumerate the list of them here. |
@cespare, can you link to discussion, please? |
@kylewolfe my post is https://groups.google.com/d/msg/golang-dev/kyckwHWpKQg/9nHp6kPzCwAJ but it hasn't yielded any responses. |
Should we also discuss how internal is handled? Currently internal packages are resolved at cmd/go as well. Should this be handled in go/build? If not, are we ok with internal continuing to be resolved by cmd/go while vendor is handled by go/build? |
@kylewolfe vendor is also implemented in cmd/go, not go/build |
@davecheney, Yes. The discussion is around moving vendor from cmd/go to go/build. |
@kylewolfe I'm sorry I misunderstood what you mean by "If not, are we ok with internal continuing to be resolved by cmd/go while vendor is handled by go/build?" |
Please, this issue is already far too muddled without talking about internal packages as well. If you wish to discuss internal packages, please use the mailing list (or open a new issue if you feel there's a bug). |
@cespare, I'm sorry, but I think we should discuss where this lives, since it's doing almost exactly the same thing. |
|
@davecheney, I could have phrased my entire post a little better :) Here is the internal implementation review: https://codereview.appspot.com/120600043/ |
CL https://golang.org/cl/17726 mentions this issue. |
CL https://golang.org/cl/17727 mentions this issue. |
CL https://golang.org/cl/17728 mentions this issue. |
Makes programs like ssadump work on packages using vendored code, for example net/http. For golang/go#12278. Depends on CL 17726 in main repository. Change-Id: Ibabf564e397044a0f449087124dd96161081baaf Reviewed-on: https://go-review.googlesource.com/17727 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
Many tools now work out of the box just rebuilding them with 1.6, thanks! |
Editor modes that invoke the goimports command on temporary copies of actual source files will need to invoke goimports -srcdir now to say where the real source directory is. Otherwise goimports will not consider vendored or internal packages when looking for new imports. In lieu of a test for cmd/goimports (because it has no tests), a command transcript: $ cd /tmp $ cat x.go package p var _ = hpack.HuffmanDecode $ $ GOPATH= goimports < x.go package p var _ = hpack.HuffmanDecode $ GOPATH= goimports x.go package p var _ = hpack.HuffmanDecode $ But with the new flag: $ GOPATH= goimports -srcdir $GOROOT/src/math < x.go package p import "golang.org/x/net/http2/hpack" var _ = hpack.HuffmanDecode $ GOPATH= goimports -srcdir $GOROOT/src/math x.go package p import "golang.org/x/net/http2/hpack" var _ = hpack.HuffmanDecode $ The tests in this CL and the above transcript assume that $GOROOT/src/vendor/golang.org/x/net/http2/hpack exists. It did in 40a26c9, but it does not today. It will again soon (once Go 1.7 opens). For golang/go#12278 (original request). Change-Id: I27b136041f54edcde4bf474215b48ebb0417f34d Reviewed-on: https://go-review.googlesource.com/17728 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
Hi,
Any chance of goimports being taught about GO15VENDOREXPERIMENT? With go 1.5 it rewrites import paths (to $CWD/vendor/path/to/3rd/party/pkg) even when GO15VENDOREXPERIMENT is set.
Thanks
Vlad
The text was updated successfully, but these errors were encountered: