summaryrefslogtreecommitdiff
path: root/vendor/github.com/gin-gonic/gin/recovery.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gin-gonic/gin/recovery.go')
-rw-r--r--vendor/github.com/gin-gonic/gin/recovery.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/vendor/github.com/gin-gonic/gin/recovery.go b/vendor/github.com/gin-gonic/gin/recovery.go
index abb645105..2955c03a0 100644
--- a/vendor/github.com/gin-gonic/gin/recovery.go
+++ b/vendor/github.com/gin-gonic/gin/recovery.go
@@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"log"
"net"
"net/http"
@@ -63,7 +62,9 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
if ne, ok := err.(*net.OpError); 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") {
+ seStr := strings.ToLower(se.Error())
+ if strings.Contains(seStr, "broken pipe") ||
+ strings.Contains(seStr, "connection reset by peer") {
brokenPipe = true
}
}
@@ -91,7 +92,7 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
}
if brokenPipe {
// If the connection is dead, we can't write a status to it.
- c.Error(err.(error)) // nolint: errcheck
+ c.Error(err.(error)) //nolint: errcheck
c.Abort()
} else {
handle(c, err)
@@ -121,7 +122,7 @@ func stack(skip int) []byte {
// Print this much at least. If we can't find the source, it won't show.
fmt.Fprintf(buf, "%s:%d (0x%x)\n", file, line, pc)
if file != lastFile {
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err != nil {
continue
}