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

net: Make errClosing public #10176

Closed
erikdubbelboer opened this issue Mar 16, 2015 · 1 comment
Closed

net: Make errClosing public #10176

erikdubbelboer opened this issue Mar 16, 2015 · 1 comment

Comments

@erikdubbelboer
Copy link
Contributor

I would like to propose to make net.errClosing public.

One use case for having this error exposed is to detect http client timeouts as demonstrated by this gist.

At the moment the only way to detect a timeout is to compare error strings:

if res, err := client.Get("http://127.0.0.1:12345/"); err != nil {
  if strings.HasSuffix(err.Error(), "use of closed network connection") { 

If the error string would ever change in the future this detection would break.

@minux
Copy link
Member

minux commented Mar 16, 2015

Dup of #4373.

@minux minux closed this as completed Mar 16, 2015
@mikioh mikioh changed the title Make net.errClosing public net: Make errClosing public Mar 16, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
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

3 participants