From 95c8965e8b897aa69a3fbdea42c79513f55457ad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 1 Jan 2023 17:46:49 -0700 Subject: lint: Turn on errorlint --- lib/diskio/kmp.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/diskio/kmp.go') 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 +// Copyright (C) 2022-2023 Luke Shumaker // // 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 -- cgit v1.2.3-2-g168b From 41432b868e09e199fa1ee7e9aa7bb45bdccb8dde Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 1 Jan 2023 21:05:11 -0700 Subject: lint: Turn on misspell --- lib/diskio/kmp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/diskio/kmp.go') diff --git a/lib/diskio/kmp.go b/lib/diskio/kmp.go index 8de3a18..6949aa4 100644 --- a/lib/diskio/kmp.go +++ b/lib/diskio/kmp.go @@ -88,7 +88,7 @@ func buildKMPTable[K ~int64, V comparable](substr Sequence[K, V]) ([]K, error) { } // IndexAll returns the starting-position of all possibly-overlapping -// occurances of 'substr' in the 'str' sequence. +// occurrences of 'substr' in the 'str' sequence. // // Will hop around in 'substr', but will only get the natural sequence // [0...) in order from 'str'. When hopping around in 'substr' it -- cgit v1.2.3-2-g168b