diff options
author | Moritz Poldrack <git@moritz.sh> | 2022-07-31 15:15:27 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-04 21:58:04 +0200 |
commit | 70bfcfef42578079f211d87cddc49519ee3503dc (patch) | |
tree | ae35c38e3980c73af2b43be10fe8cc9ece4f3f9a /lib/crypto/pgp | |
parent | 978d35d356e8752bdd272884df48a6289d88b40a (diff) | |
download | aerc-70bfcfef42578079f211d87cddc49519ee3503dc.tar.gz |
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 <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/crypto/pgp')
-rw-r--r-- | lib/crypto/pgp/pgp.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/crypto/pgp/pgp.go b/lib/crypto/pgp/pgp.go index 579395f9..689bae3f 100644 --- a/lib/crypto/pgp/pgp.go +++ b/lib/crypto/pgp/pgp.go @@ -33,7 +33,7 @@ func (m *Mail) Init() error { logging.Infof("Initializing PGP keyring") err := os.MkdirAll(path.Join(xdg.DataHome(), "aerc"), 0o700) if err != nil { - return fmt.Errorf("failed to create data directory: %v", err) + return fmt.Errorf("failed to create data directory: %w", err) } lockpath := path.Join(xdg.DataHome(), "aerc", "keyring.lock") @@ -290,16 +290,16 @@ func (m *Mail) ExportKey(k string) (io.Reader, error) { pks := bytes.NewBuffer(nil) err = entity.Serialize(pks) if err != nil { - return nil, fmt.Errorf("pgp: error exporting key: %v", err) + return nil, fmt.Errorf("pgp: error exporting key: %w", err) } pka := bytes.NewBuffer(nil) w, err := armor.Encode(pka, "PGP PUBLIC KEY BLOCK", map[string]string{}) if err != nil { - return nil, fmt.Errorf("pgp: error exporting key: %v", err) + return nil, fmt.Errorf("pgp: error exporting key: %w", err) } _, err = w.Write(pks.Bytes()) if err != nil { - return nil, fmt.Errorf("pgp: error exporting key: %v", err) + return nil, fmt.Errorf("pgp: error exporting key: %w", err) } w.Close() return pka, nil |