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

@erikdubbelboer erikdubbelboer commented Mar 16, 2015

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

This comment has been minimized.

Copy link
Member

@minux minux commented Mar 16, 2015

Dup of #4373.

@minux minux closed this 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.