From 70bfcfef42578079f211d87cddc49519ee3503dc Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Sun, 31 Jul 2022 15:15:27 +0200 Subject: lint: work nicely with wrapped errors (errorlint) Error wrapping as introduced in Go 1.13 adds some additional logic to use for comparing errors and adding information to it. Signed-off-by: Moritz Poldrack Acked-by: Robin Jarry --- worker/notmuch/lib/database.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'worker/notmuch/lib/database.go') diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index e8a581c6..007a0a7e 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -4,6 +4,7 @@ package lib import ( + "errors" "fmt" "time" @@ -55,7 +56,7 @@ func (db *DB) connect(writable bool) error { var err error db.db, err = notmuch.Open(db.path, mode) if err != nil { - return fmt.Errorf("could not connect to notmuch db: %v", err) + return fmt.Errorf("could not connect to notmuch db: %w", err) } db.lastOpenTime = time.Now() return nil @@ -112,7 +113,7 @@ func (db *DB) newQuery(ndb *notmuch.DB, query string) (*notmuch.Query, error) { q.SetSortScheme(notmuch.SORT_OLDEST_FIRST) for _, t := range db.excludedTags { err := q.AddTagExclude(t) - if err != nil && err != notmuch.ErrIgnored { + if errors.Is(err, notmuch.ErrIgnored) { return nil, err } } -- cgit