diff --git a/cmd/notation/login.go b/cmd/notation/login.go index d7d4309e6..711d5d20d 100644 --- a/cmd/notation/login.go +++ b/cmd/notation/login.go @@ -112,16 +112,16 @@ func runLogin(ctx context.Context, opts *loginOpts) error { cred := opts.Credential() credsStore, err := auth.NewCredentialsStore() if err != nil { - return fmt.Errorf("failed to get credentials store: %v", err) + return fmt.Errorf("failed to get credentials store: %w", err) } registry, err := getRegistryLoginClient(ctx, &opts.SecureFlagOpts, serverAddress) if err != nil { - return fmt.Errorf("failed to get registry client: %v", err) + return fmt.Errorf("failed to get registry client: %w", err) } if err := credentials.Login(ctx, credsStore, registry, cred); err != nil { registryName := registry.Reference.Registry if !errors.Is(err, credentials.ErrPlaintextPutDisabled) { - return fmt.Errorf("failed to log in to %s: %v", registryName, err) + return fmt.Errorf("failed to log in to %s: %w", registryName, err) } // ErrPlaintextPutDisabled returned by Login() indicates that the diff --git a/cmd/notation/logout.go b/cmd/notation/logout.go index ef89c2b31..f9678bb23 100644 --- a/cmd/notation/logout.go +++ b/cmd/notation/logout.go @@ -56,10 +56,10 @@ func runLogout(ctx context.Context, opts *logoutOpts) error { ctx = opts.LoggingFlagOpts.InitializeLogger(ctx) credsStore, err := auth.NewCredentialsStore() if err != nil { - return fmt.Errorf("failed to get credentials store: %v", err) + return fmt.Errorf("failed to get credentials store: %w", err) } if err := credentials.Logout(ctx, credsStore, opts.server); err != nil { - return fmt.Errorf("failed to log out of %s: %v", opts.server, err) + return fmt.Errorf("failed to log out of %s: %w", opts.server, err) } fmt.Println("Logout Succeeded")