summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-01-01 17:46:49 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-01-01 22:42:08 -0700
commit95c8965e8b897aa69a3fbdea42c79513f55457ad (patch)
tree41da9e3416b8bf5378b253e25db0932d569de5db
parent1faafcd3809fe5b452a1a742137ca2cb7336aad6 (diff)
lint: Turn on errorlint
-rw-r--r--.golangci.yml1
-rw-r--r--lib/diskio/kmp.go6
2 files changed, 5 insertions, 2 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 077a82b..7dd7f00 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -25,7 +25,6 @@ linters:
# These are disabled not because I think they're bad, but because
# they currently don't pass, and I haven't evaluated them yet.
- cyclop
- - errorlint
- exhaustive
- exhaustruct
- forcetypeassert
diff --git a/lib/diskio/kmp.go b/lib/diskio/kmp.go
index 5f6e295..8de3a18 100644
--- a/lib/diskio/kmp.go
+++ b/lib/diskio/kmp.go
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com>
+// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com>
//
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -15,6 +15,7 @@ func kmpEq2[K ~int64, V comparable](aS Sequence[K, V], aI K, bS Sequence[K, V],
aV, aErr := aS.Get(aI)
bV, bErr := bS.Get(bI)
if aErr != nil {
+ //nolint:errorlint // The == is just a fast-path; we still fall back to errors.Is.
if aErr == ErrWildcard || errors.Is(aErr, ErrWildcard) {
aV = bV
aErr = nil
@@ -23,6 +24,7 @@ func kmpEq2[K ~int64, V comparable](aS Sequence[K, V], aI K, bS Sequence[K, V],
}
}
if bErr != nil {
+ //nolint:errorlint // The == is just a fast-path; we still fall back to errors.Is.
if bErr == ErrWildcard || errors.Is(bErr, ErrWildcard) {
bV = aV
bErr = nil
@@ -39,6 +41,7 @@ func kmpEq2[K ~int64, V comparable](aS Sequence[K, V], aI K, bS Sequence[K, V],
func kmpEq1[K ~int64, V comparable](aV V, bS Sequence[K, V], bI K) bool {
bV, bErr := bS.Get(bI)
if bErr != nil {
+ //nolint:errorlint // The == is just a fast-path; we still fall back to errors.Is.
if bErr == ErrWildcard || errors.Is(bErr, ErrWildcard) {
return true
}
@@ -53,6 +56,7 @@ func kmpEq1[K ~int64, V comparable](aV V, bS Sequence[K, V], bI K) bool {
func buildKMPTable[K ~int64, V comparable](substr Sequence[K, V]) ([]K, error) {
var substrLen K
for {
+ //nolint:errorlint // The == is just a fast-path; we still fall back to errors.Is.
if _, err := substr.Get(substrLen); err != nil && !(err == ErrWildcard || errors.Is(err, ErrWildcard)) {
if errors.Is(err, io.EOF) {
break