aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/gpg/gpgbin/gpgbin.go
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2022-07-29 22:31:54 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-04 21:57:57 +0200
commit5ca6022d007bc83daba1e7297480d37f56554455 (patch)
treecc592d08276b7f0c8db6a4280bb7fb648b2548fe /lib/crypto/gpg/gpgbin/gpgbin.go
parenta8d631177f4315810f0ab7c7d66d38e332ab0916 (diff)
downloadaerc-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/gpgbin.go')
-rw-r--r--lib/crypto/gpg/gpgbin/gpgbin.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/crypto/gpg/gpgbin/gpgbin.go b/lib/crypto/gpg/gpgbin/gpgbin.go
index 2eb83dc9..1e8c7dcd 100644
--- a/lib/crypto/gpg/gpgbin/gpgbin.go
+++ b/lib/crypto/gpg/gpgbin/gpgbin.go
@@ -63,7 +63,11 @@ func getIdentity(key uint64) string {
var outbuf strings.Builder
cmd.Stdout = &outbuf
- cmd.Run()
+ err := cmd.Run()
+ if err != nil {
+ logging.Errorf("gpg: failed to get identity: %v", err)
+ return ""
+ }
out := strings.Split(outbuf.String(), "\n")
for _, line := range out {
if strings.HasPrefix(line, "uid") {
@@ -85,7 +89,11 @@ func getKeyId(s string, private bool) string {
var outbuf strings.Builder
cmd.Stdout = &outbuf
- cmd.Run()
+ err := cmd.Run()
+ if err != nil {
+ logging.Errorf("gpg: failed to get key ID: %v", err)
+ return ""
+ }
out := strings.Split(outbuf.String(), "\n")
for _, line := range out {
if strings.HasPrefix(line, "fpr") {