From d1637e0da72be41efaccd5ca0b1ee3eb799265af Mon Sep 17 00:00:00 2001 From: Adrian Utrilla Date: Tue, 12 Sep 2017 09:19:58 -0700 Subject: [PATCH] Use custom error type for pgp instead of Errorf --- pgp/keysource.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pgp/keysource.go b/pgp/keysource.go index b71c2cf53..2b3e1e4cb 100644 --- a/pgp/keysource.go +++ b/pgp/keysource.go @@ -123,9 +123,9 @@ func (key *MasterKey) Encrypt(dataKey []byte) error { return nil } log.Printf("Encryption of PGP MasterKey with fingerprint %s failed", key.Fingerprint) - return fmt.Errorf(`could not encrypt data key with PGP key. - \tgolang.org/x/crypto/openpgp error: %s - \tGPG binary error: %s`, openpgpErr, binaryErr) + return fmt.Errorf( + `could not encrypt data key with PGP key: golang.org/x/crypto/openpgp error: %v; GPG binary error: %v`, + openpgpErr, binaryErr) } // EncryptIfNeeded encrypts the data key with PGP only if it's needed, that is, if it hasn't been encrypted already @@ -188,9 +188,9 @@ func (key *MasterKey) Decrypt() ([]byte, error) { return dataKey, nil } log.Printf("Decryption of GPG MasterKey with fingerprint %s failed", key.Fingerprint) - return nil, fmt.Errorf(`could not encrypt data key with PGP key. - \tgolang.org/x/crypto/openpgp error: %s - \tGPG binary error: %s`, openpgpErr, binaryErr) + return nil, fmt.Errorf( + `could not decrypt data key with PGP key: golang.org/x/crypto/openpgp error: %v; GPG binary error: %v`, + openpgpErr, binaryErr) } // NeedsRotation returns whether the data key needs to be rotated or not