Switch from x/net/context -> context#36904
Conversation
|
We'll probably need something similar for swarmkit, containerd, libnetwork as well (assuming it works) |
|
Looks like you need to (re-)vendor something |
Looking into it...
Oops, the sed regex was too greedy. Fixed. |
|
It looks like as long as Go >= 1.9 is used, we can mix |
|
Nice, it looks like the switch revealed a couple of bugs in the code: |
FYI, you can do this migration with |
Just found that out myself. The problems with the above tool are:
|
|
CI failure on experimental: Hmm, it does not look related but does not look like a flaky test either |
|
I think I just saw that one fail on another PR as well |
I guess it would need a |
|
@kolyshkin needs a rebase 😅, also perhaps it's good to keep the fixes in a separate PR |
Unfortunately not -- in case there is an empty line between "standard" and "prefixed" packages, it still won't have "context" in the line it should be, this is why I have to do |
Codecov Report
@@ Coverage Diff @@
## master #36904 +/- ##
=========================================
Coverage ? 35.06%
=========================================
Files ? 614
Lines ? 45694
Branches ? 0
=========================================
Hits ? 16024
Misses ? 27565
Partials ? 2105 |
done
will do |
done (#36920), but this way CI here will fail as in #36904 (comment) |
|
rebased again |
cpuguy83
left a comment
There was a problem hiding this comment.
If CI is happy I'm happy. LGTM!
|
|
@cpuguy83 the fix for this is separated to #36920 as per request in #36904 (comment) |
Since Go 1.7, context is a standard package. Since Go 1.9, everything that is provided by "x/net/context" is a couple of type aliases to types in "context". Many vendored packages still use x/net/context, so vendor entry remains for now. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
Rebased to master (with #36920 merged) |
Since Go 1.7,
contextis a standard package. Since Go 1.9, allx/net/contextis a few aliases to types incontext.Many vendored packages still use x/net/context, so vendor entry remains for now.
The commit is generated by this ugly script (I'm bad at sed so had to use awk in between):
Note that there is a "standard" way of doing this change -- by running the
go tool fix -r context, what it does is the same as thesedabove. In addition, I had to fix the"context"line placement which was tricky in case there are empty lines in the imports list (thus the twogoimportswith an awk in between.