aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/polyfloyd
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/polyfloyd')
-rw-r--r--vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go4
-rw-r--r--vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go5
-rw-r--r--vendor/github.com/polyfloyd/go-errorlint/errorlint/printf.go17
3 files changed, 9 insertions, 17 deletions
diff --git a/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go b/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go
index df8d5f713..8bfb4c9b2 100644
--- a/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go
+++ b/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go
@@ -41,6 +41,7 @@ var allowedErrors = []struct {
{err: "io.EOF", fun: "debug/elf.Open"},
{err: "io.EOF", fun: "debug/elf.NewFile"},
// pkg/io
+ {err: "io.EOF", fun: "(io.ReadCloser).Read"},
{err: "io.EOF", fun: "(io.Reader).Read"},
{err: "io.EOF", fun: "(io.ReaderAt).ReadAt"},
{err: "io.EOF", fun: "(*io.LimitedReader).Read"},
@@ -71,6 +72,9 @@ var allowedErrors = []struct {
{err: "io.EOF", fun: "(*strings.Reader).ReadAt"},
{err: "io.EOF", fun: "(*strings.Reader).ReadByte"},
{err: "io.EOF", fun: "(*strings.Reader).ReadRune"},
+ // pkg/context
+ {err: "context.DeadlineExceeded", fun: "(context.Context).Err"},
+ {err: "context.Canceled", fun: "(context.Context).Err"},
}
var allowedErrorWildcards = []struct {
diff --git a/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go b/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go
index 817cd6904..572a3816d 100644
--- a/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go
+++ b/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go
@@ -307,6 +307,11 @@ func LintErrorTypeAssertions(fset *token.FileSet, info *TypesInfoExt) []analysis
continue
}
+ // If the asserted type is not an error, allow the expression.
+ if !implementsError(info.TypesInfo.Types[typeAssert.Type].Type) {
+ continue
+ }
+
lints = append(lints, analysis.Diagnostic{
Message: "type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors",
Pos: typeAssert.Pos(),
diff --git a/vendor/github.com/polyfloyd/go-errorlint/errorlint/printf.go b/vendor/github.com/polyfloyd/go-errorlint/errorlint/printf.go
index 973752592..4c0e12525 100644
--- a/vendor/github.com/polyfloyd/go-errorlint/errorlint/printf.go
+++ b/vendor/github.com/polyfloyd/go-errorlint/errorlint/printf.go
@@ -7,23 +7,6 @@ import (
"strings"
)
-func verbOrder(verbs []verb, numArgs int) [][]verb {
- orderedVerbs := make([][]verb, numArgs)
- i := 0
- for _, v := range verbs {
- if v.index != -1 {
- i = v.index - 1
- }
- if i >= len(orderedVerbs) {
- continue
- }
- orderedVerbs[i] = append(orderedVerbs[i], v)
- verbs = verbs[1:]
- i++
- }
- return orderedVerbs
-}
-
type verb struct {
format string
formatOffset int