-
Couldn't load subscription status.
- Fork 106
Replace deprecated Transport.Dial with Transport.DialContext #58
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
Conversation
Signed-off-by: Paul Donohue <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @thaJeztah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| Timeout: defaultTimeout, | ||
| } | ||
| tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { | ||
| // DialPipeContext() has been added to winio: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhowardmsft do you know if a new release is planned?
|
How was this change tested? For me it doesn't build: $ go get golang.org/x/net/proxy
$ go get github.com/pkg/errors
$ go get github.com/stretchr/testify/assert
$ go test ./...
? github.com/docker/go-connections [no test files]
# github.com/docker/go-connections/sockets [github.com/docker/go-connections/sockets.test]
sockets/sockets.go:34:26: dialer.DialContext undefined (type proxy.Dialer has no field or method DialContext)
sockets/sockets_unix.go:24:28: undefined: context
ok github.com/docker/go-connections/nat (cached)
ok github.com/docker/go-connections/proxy (cached)
FAIL github.com/docker/go-connections/sockets [build failed]
ok github.com/docker/go-connections/tlsconfig (cached)The naive change just kicks the can a bit further down the road: diff --git a/sockets/proxy.go b/sockets/proxy.go
index 98e9a1d..36978c8 100644
--- a/sockets/proxy.go
+++ b/sockets/proxy.go
@@ -23,7 +23,7 @@ func GetProxyEnv(key string) string {
// DialerFromEnvironment takes in a "direct" *net.Dialer and returns a
// proxy.Dialer which will route the connections through the proxy using the
// given dialer.
-func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error) {
+func DialerFromEnvironment(direct *net.Dialer) (proxy.ContextDialer, error) {
allProxy := GetProxyEnv("all_proxy")
if len(allProxy) == 0 {
return direct, nilproduces: $ go test ./...
? github.com/docker/go-connections [no test files]
ok github.com/docker/go-connections/nat (cached)
# github.com/docker/go-connections/sockets [github.com/docker/go-connections/sockets.test]
sockets/proxy.go:44:3: cannot use proxyFromURL (type proxy.Dialer) as type proxy.ContextDialer in return argument:
proxy.Dialer does not implement proxy.ContextDialer (missing DialContext method)
sockets/sockets_unix.go:24:28: undefined: context
ok github.com/docker/go-connections/proxy (cached)
FAIL github.com/docker/go-connections/sockets [build failed]
ok github.com/docker/go-connections/tlsconfig (cached)I can't see a variant of |
That's weird, I think CI was green 🤔 |
|
Oh, wait; there's #61 Looking at that PR, it looks like CI isn't running 😞 |
Correction: + |
Fix problems introduced by #58
http.Transport.Dial is deprecated. Other parts of Docker have been updated to use DialContext instead (for example: https://github.com/moby/moby/blob/master/client/options.go#L66), but go-connections is currently still using Dial.
This commit updates go-connections to use DialContext.