1
0
Fork 0
mirror of https://github.com/Luzifer/envrun.git synced 2024-12-20 18:31:17 +00:00

Fix: fmt.Errorf behaves different than errors.Wrap

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-11-04 13:12:44 +01:00
parent 2609dc1859
commit d3a200721a
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -56,12 +56,18 @@ func decryptGPGSymmetric(body []byte, passphrase string) ([]byte, error) {
} }
data, err := io.ReadAll(md.UnverifiedBody) data, err := io.ReadAll(md.UnverifiedBody)
return data, fmt.Errorf("reading GPG body: %w", err) if err != nil {
return nil, fmt.Errorf("reading GPG body: %w", err)
}
return data, nil
} }
func decryptOpenSSL(kdf openssl.CredsGenerator) decryptMethod { func decryptOpenSSL(kdf openssl.CredsGenerator) decryptMethod {
return func(body []byte, passphrase string) ([]byte, error) { return func(body []byte, passphrase string) ([]byte, error) {
data, err := openssl.New().DecryptBytes(cfg.Password, body, kdf) data, err := openssl.New().DecryptBytes(cfg.Password, body, kdf)
return data, fmt.Errorf("decrypting data: %w", err) if err != nil {
return nil, fmt.Errorf("decrypting data: %w", err)
}
return data, nil
} }
} }