1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2025-03-16 05:28:15 +00:00

ssh-to-pgp: use %w for fmt.Errorf calls

This commit is contained in:
Jörg Thalheim 2020-07-30 16:21:47 +01:00
parent 01e4038c9a
commit df86cc4e71
No known key found for this signature in database
GPG key ID: 003F2096411B5F92

View file

@ -40,12 +40,12 @@ func convertKeys(args []string) error {
if opts.in == "-" { if opts.in == "-" {
sshKey, _ = ioutil.ReadAll(os.Stdin) sshKey, _ = ioutil.ReadAll(os.Stdin)
if err != nil { if err != nil {
return fmt.Errorf("error reading stdin: %s", err) return fmt.Errorf("error reading stdin: %w", err)
} }
} else { } else {
sshKey, err = ioutil.ReadFile(opts.in) sshKey, err = ioutil.ReadFile(opts.in)
if err != nil { if err != nil {
return fmt.Errorf("error reading %s: %s", opts.in, err) return fmt.Errorf("error reading %s: %w", opts.in, err)
} }
} }
@ -53,7 +53,7 @@ func convertKeys(args []string) error {
if opts.out != "-" { if opts.out != "-" {
writer, err = os.Create(opts.out) writer, err = os.Create(opts.out)
if err != nil { if err != nil {
return fmt.Errorf("failed to create %s: %s", opts.out, err) return fmt.Errorf("failed to create %s: %w", opts.out, err)
} }
defer writer.Close() defer writer.Close()
} }
@ -65,7 +65,7 @@ func convertKeys(args []string) error {
} }
writer, err = armor.Encode(writer, keyType, make(map[string]string)) writer, err = armor.Encode(writer, keyType, make(map[string]string))
if err != nil { if err != nil {
return fmt.Errorf("failed to encode armor writer") return fmt.Errorf("failed to encode armor writer: %w", err)
} }
} }