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
x/net/webdav: replace "golang.org/x/net/context" with "context" #21364
Comments
We won't drop Go 1.8 support until at least after Go 1.11 is released, but I don't think we need to wait until Go 1.11 to do something now. For example, we could follow the "< 1.9" vs ">= 1.9" split in the golang.org/x/image/draw package, based on build tags:
A year or two from now, we can delete go1_8.go and rename or merge go1_9.go, both in x/image/draw and in x/net/webdav. |
I suggested using build tags on November 2016:
You responded at the time with:
You're suggesting build tags as a viable solution now. Is it because type aliases enable us to do something we couldn't do previously? (I'm just trying to understand what factors have changed since then.) If using build tags is an acceptable solution, I'm happy to work on a CL to resolve this issue (unless someone else wants to take it). |
Ah, I forgot that the type in question (context.Context) is defined in a different package, so it's unlike the x/image/draw package where is Op type is defined in the same package can be easily defined/aliased before/after Go 1.9. Yeah, build tags don't seem as viable for x/net/webdav, even with type aliases, due to all the code duplication it would require. I agree that we're not going to do anything for now, and are waiting on "when we don't have to support anything prior to 1.9". |
Change https://golang.org/cl/148438 mentions this issue: |
We are officially in that state as of Nov 1st. I'm actively deleting any Go 1.8 and earlier code. |
The issue golang/go#21364 has been resolved upstream, so we can also switch to importing package context here. Follows golang/net@04ba8c8.
This is a long term tracking issue for the task of replacing "golang.org/x/net/context" import with "context". Doing so is desirable because otherwise, modern Go packages end up having no choice but to import both of those 2 packages, which is suboptimal (but currently a lesser evil than the alternatives).
This is somewhat similar to #21358, but a complication is that this changes the definition of the
webdav.FileSystem
interface. That interface is quite popular (as far as I know) and has many implementations outside.The conversation about this was started in the CL that added
context.Context
as first parameter to allwebdav.FileSystem
methods:https://go-review.googlesource.com/c/32421#message-528154c59254446fadf063500da3911231523950
The latest comment was from @nigeltao saying that:
An update on that. Go 1.9 final is close to release. Type aliases have been added indeed, and the implementation of
golang.org/x/net/context
package in Go 1.9+ is just:(Source.)
So, if my understanding is correct, we are now waiting on "when we don't have to support anything prior to 1.9", which is probably going to be around Go 1.11 or later becoming stable. Is my understanding right @nigeltao?
The text was updated successfully, but these errors were encountered: