{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/4373","labels_url":"https://api.github.com/repos/golang/go/issues/4373/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/4373/comments","events_url":"https://api.github.com/repos/golang/go/issues/4373/events","html_url":"https://github.com/golang/go/issues/4373","id":51282038,"number":4373,"title":"net: errClosing not exported","user":{"login":"gopherbot","id":8566911,"avatar_url":"https://avatars.githubusercontent.com/u/8566911?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherbot","html_url":"https://github.com/gopherbot","followers_url":"https://api.github.com/users/gopherbot/followers","following_url":"https://api.github.com/users/gopherbot/following{/other_user}","gists_url":"https://api.github.com/users/gopherbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherbot/subscriptions","organizations_url":"https://api.github.com/users/gopherbot/orgs","repos_url":"https://api.github.com/users/gopherbot/repos","events_url":"https://api.github.com/users/gopherbot/events{/privacy}","received_events_url":"https://api.github.com/users/gopherbot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/6","html_url":"https://github.com/golang/go/milestones/Unplanned","labels_url":"https://api.github.com/repos/golang/go/milestones/6/labels","id":1055141,"number":6,"title":"Unplanned","description":"No plan to fix in any specific release.\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":1244,"closed_issues":232,"state":"open","created_at":"2015-04-06T20:47:19Z","updated_at":"2016-01-30T18:25:06Z","due_on":"2099-12-31T05:00:00Z","closed_at":null},"comments":52,"created_at":"2012-11-11T19:56:32Z","updated_at":"2016-02-01T01:45:29Z","closed_at":null,"body":"by **stephen@q5comm.com**:\n\n<pre>I have seen the issue in 1.0.3 and from checking tip.golang.org, it is still a problem.\n\nnet.errClosing is an errors.New() that is not exported but returned to the user. This\nmeans that in order for a user to check for the &quot;errClosing&quot;, they need to\ncheck the error string.\n\nI suggest renaming to ErrClosing so that a client can easily check if another goroutine\nclosed it's connection.</pre>"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/177692924","html_url":"https://github.com/golang/go/issues/4373#issuecomment-177692924","issue_url":"https://api.github.com/repos/golang/go/issues/4373","id":177692924,"user":{"login":"winlinvip","id":2777660,"avatar_url":"https://avatars.githubusercontent.com/u/2777660?v=3","gravatar_id":"","url":"https://api.github.com/users/winlinvip","html_url":"https://github.com/winlinvip","followers_url":"https://api.github.com/users/winlinvip/followers","following_url":"https://api.github.com/users/winlinvip/following{/other_user}","gists_url":"https://api.github.com/users/winlinvip/gists{/gist_id}","starred_url":"https://api.github.com/users/winlinvip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winlinvip/subscriptions","organizations_url":"https://api.github.com/users/winlinvip/orgs","repos_url":"https://api.github.com/users/winlinvip/repos","events_url":"https://api.github.com/users/winlinvip/events{/privacy}","received_events_url":"https://api.github.com/users/winlinvip/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T01:45:29Z","updated_at":"2016-02-01T01:45:29Z","body":"I got the same problem, for I will close the listener in another gorotine like:\r\n```\r\nl, _ = net.Listen(\"tcp\", ...)\r\nerr = http.Serve(l, ...)\r\n\r\ngo func(){\r\n    <- closing\r\n    _ = l.Close()\r\n}()\r\n```\r\n\r\nSo, I want to know whether the err is errClosing or another critical error. But I find a wordaround, to set the state in my application level:\r\n\r\n```\r\nisListenerClosed := false\r\n\r\nl, _ = net.Listen(\"tcp\", ...)\r\nif err = http.Serve(l, ...); err != nil {\r\n    if isListenerClosed {\r\n        // it's closed by me.\r\n    }\r\n    // critical error.\r\n}\r\n\r\ngo func(){\r\n    <- closing\r\n    isListenerClosed = true\r\n    _ = l.Close()\r\n}()\r\n```"}}