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: add context import path upgrade to go tool fix #17040

Closed
SamWhited opened this issue Sep 9, 2016 · 7 comments
Closed

Proposal: add context import path upgrade to go tool fix #17040

SamWhited opened this issue Sep 9, 2016 · 7 comments

Comments

@SamWhited
Copy link
Member

SamWhited commented Sep 9, 2016

It would be convenient if go tool fix had a rule (possibly off by default?) added to upgrade imports of the context package to the new version in the standard library.

Here is a CL that I'm using to upgrade my projects: https://go-review.googlesource.com/#/c/28872/

This makes the new rewrites list read as follows:

Available rewrites are:

context
        Change imports of golang.org/x/net/context to context

gotypes
        Change imports of golang.org/x/tools/go/{exact,types} to go/{constant,types}

netipv6zone
        Adapt element key to IPAddr, UDPAddr or TCPAddr composite literals.

        https://codereview.appspot.com/6849045/

printerconfig
        Add element keys to Config composite literals.

This isn't strictly the same as some of the other rewrites in the tool because the old context package is still perfectly usable, so maybe it would be best to leave this fix off by default and allow it to be manually specified.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/28872 mentions this issue.

@quentinmit
Copy link
Contributor

You likely want to remain with the old package for quite a while to support building with Go <1.7. I think perhaps we'd want to do this a year or more from now.

@quentinmit quentinmit added this to the Go1.8Maybe milestone Sep 12, 2016
@SamWhited
Copy link
Member Author

SamWhited commented Sep 12, 2016

Agreed, having it off by default seems sensible, but going ahead and putting it in the tool seems like it would be nice for those who explicitly want to upgrade.

@SamWhited
Copy link
Member Author

SamWhited commented Sep 12, 2016

I've updated the CL to require -force context for the fix to be run (it looks like force wasn't otherwise used). Would this be an acceptible way to do it? The behavior could then be changed after the 1.8 release cycle or whenever the Go team decides it's more appropriate to be default-on.

@adg
Copy link
Contributor

adg commented Sep 12, 2016

cc @bradfitz

@bradfitz
Copy link
Contributor

We still ship and use go tool fix? Flashback!

@bradfitz
Copy link
Contributor

But yeah, SGTM. Opt-in sounds good.

@golang golang locked and limited conversation to collaborators Sep 15, 2017
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

5 participants