diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2024-05-03 14:12:39 +0200 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-05-06 15:32:06 +0000 |
commit | e0324fcdb510ad91eaeb1f9bd7a1b7d564f7c549 (patch) | |
tree | be452ecfeda1390815dcdfa2b0f2fccd9060d2f8 | |
parent | b20cd5933aa9ba90f6299e6c2cbb59733434636e (diff) | |
download | golang-x-net-e0324fcdb510ad91eaeb1f9bd7a1b7d564f7c549.tar.gz |
http2: use net.ErrClosed
Use errors.Is(err, net.ErrClosed) instead of checking for a known
string. net.ErrClosed is available since Go 1.16, the current minimum
version in go.mod is Go 1.18.
For golang/go#4373
Change-Id: Id98771874434bae7d9c6d1d4d36fddb28822eb39
Reviewed-on: https://go-review.googlesource.com/c/net/+/583016
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r-- | http2/server.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/http2/server.go b/http2/server.go index 278add7..c5d0810 100644 --- a/http2/server.go +++ b/http2/server.go @@ -732,11 +732,7 @@ func isClosedConnError(err error) bool { return false } - // TODO: remove this string search and be more like the Windows - // case below. That might involve modifying the standard library - // to return better error types. - str := err.Error() - if strings.Contains(str, "use of closed network connection") { + if errors.Is(err, net.ErrClosed) { return true } |