diff options
author | Moritz Poldrack <git@moritz.sh> | 2022-07-29 22:31:54 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-04 21:57:57 +0200 |
commit | 5ca6022d007bc83daba1e7297480d37f56554455 (patch) | |
tree | cc592d08276b7f0c8db6a4280bb7fb648b2548fe /lib/crypto/gpg/gpgbin/verify.go | |
parent | a8d631177f4315810f0ab7c7d66d38e332ab0916 (diff) | |
download | aerc-5ca6022d007bc83daba1e7297480d37f56554455.tar.gz |
lint: ensure errors are at least logged (errcheck)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/crypto/gpg/gpgbin/verify.go')
-rw-r--r-- | lib/crypto/gpg/gpgbin/verify.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/crypto/gpg/gpgbin/verify.go b/lib/crypto/gpg/gpgbin/verify.go index be9f26f7..e5930849 100644 --- a/lib/crypto/gpg/gpgbin/verify.go +++ b/lib/crypto/gpg/gpgbin/verify.go @@ -2,6 +2,7 @@ package gpgbin import ( "bytes" + "fmt" "io" "io/ioutil" "os" @@ -19,7 +20,7 @@ func Verify(m io.Reader, s io.Reader) (*models.MessageDetails, error) { if err != nil { return nil, err } - io.Copy(sig, s) + _, _ = io.Copy(sig, s) sig.Close() defer os.Remove(sig.Name()) args = append(args, sig.Name(), "-") @@ -29,11 +30,17 @@ func Verify(m io.Reader, s io.Reader) (*models.MessageDetails, error) { return nil, err } g := newGpg(bytes.NewReader(orig), args) - g.cmd.Run() + err = g.cmd.Run() + if err != nil { + return nil, fmt.Errorf("gpg: failed to run verification: %w", err) + } out := bytes.NewReader(g.stdout.Bytes()) md := new(models.MessageDetails) - parse(out, md) + err = parse(out, md) + if err != nil { + return nil, fmt.Errorf("gpg: failed to parse result: %w", err) + } md.Body = bytes.NewReader(orig) |