From df86cc4e71e2a4fb8647c106f4f979cd4b840341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 30 Jul 2020 16:21:47 +0100 Subject: [PATCH] ssh-to-pgp: use %w for fmt.Errorf calls --- pkgs/ssh-to-pgp/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/ssh-to-pgp/main.go b/pkgs/ssh-to-pgp/main.go index b9f1a2b..b921053 100644 --- a/pkgs/ssh-to-pgp/main.go +++ b/pkgs/ssh-to-pgp/main.go @@ -40,12 +40,12 @@ func convertKeys(args []string) error { if opts.in == "-" { sshKey, _ = ioutil.ReadAll(os.Stdin) if err != nil { - return fmt.Errorf("error reading stdin: %s", err) + return fmt.Errorf("error reading stdin: %w", err) } } else { sshKey, err = ioutil.ReadFile(opts.in) 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 != "-" { writer, err = os.Create(opts.out) 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() } @@ -65,7 +65,7 @@ func convertKeys(args []string) error { } writer, err = armor.Encode(writer, keyType, make(map[string]string)) if err != nil { - return fmt.Errorf("failed to encode armor writer") + return fmt.Errorf("failed to encode armor writer: %w", err) } }