net/http: Transport.DialContext breaks existing code #16703
Closed
Labels
Milestone
Comments
This might've been something to consider changing during the betas or first 5 release candidates. Too late now, though. There might be something we could add to the Go 1 compatibility document (similar to what we added about unkeyed struct literals) about promises (or lack thereof?) here. |
Sorry for the late report - I only encountered the issue this morning. I can accept that it won't be changed now, but I think perhaps the issue points towards a better way to do compatibility in general. I would certainly have been inclined to give precedence to new fields until I saw this. |
I went to document this, but I'm not sure what to document. Closing for now, but please reopen if you have suggestions. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In Go 1.7 the new http.Transport.DialContext field overrides the Dial field.
This breaks any existing code that takes the http.DefaultTransport,
sets Dial and expects network calls to be made using that value.
This did actually break some of our test code that used this functionality
to prevent accidental external network access in tests.
For better backward compatibility, perhaps it might be better to make Dial
override DialContext - existing code will continue to work unchanged
and most new code will never touch Dial, so the override isn't so important
in that case.
The text was updated successfully, but these errors were encountered: