Skip to content

Commit e0324fc

Browse files
tklausergopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Damien Neil <[email protected]> Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent b20cd59 commit e0324fc

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

http2/server.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,11 +732,7 @@ func isClosedConnError(err error) bool {
732732
return false
733733
}
734734

735-
// TODO: remove this string search and be more like the Windows
736-
// case below. That might involve modifying the standard library
737-
// to return better error types.
738-
str := err.Error()
739-
if strings.Contains(str, "use of closed network connection") {
735+
if errors.Is(err, net.ErrClosed) {
740736
return true
741737
}
742738

0 commit comments

Comments
 (0)