golangci(lint) : more linters (#2870)

This commit is contained in:
Matthieu MOREL
2021-09-21 09:22:21 +02:00
committed by GitHub
parent 3a6f18f32f
commit 71f7087097
7 changed files with 24 additions and 8 deletions

View File

@ -6,6 +6,7 @@ package gin
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
@ -60,7 +61,8 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
// condition that warrants a panic stack trace.
var brokenPipe bool
if ne, ok := err.(*net.OpError); ok {
if se, ok := ne.Err.(*os.SyscallError); ok {
var se *os.SyscallError
if errors.As(ne, &se) {
if strings.Contains(strings.ToLower(se.Error()), "broken pipe") || strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {
brokenPipe = true
}