diff --git a/internal/commands/repo/rm.go b/internal/commands/repo/rm.go index 5039b02..c2df533 100644 --- a/internal/commands/repo/rm.go +++ b/internal/commands/repo/rm.go @@ -41,7 +41,7 @@ type rmOptions struct { force bool } -var ErrCanceled = errors.New("canceled") +var errCanceled = errors.New("canceled") func newRmCmd(streams command.Streams, hubClient *hub.Client, parent string) *cobra.Command { var opts rmOptions @@ -55,7 +55,7 @@ func newRmCmd(streams command.Streams, hubClient *hub.Client, parent string) *co }, RunE: func(cmd *cobra.Command, args []string) error { err := runRm(cmd.Context(), streams, hubClient, opts, args[0]) - if err == nil || err == ErrCanceled { + if err == nil || err == errCanceled { return nil } return err @@ -92,7 +92,7 @@ func runRm(ctx context.Context, streams command.Streams, hubClient *hub.Client, input := "" select { case <-ctx.Done(): - return ErrCanceled + return errCanceled case input = <-userIn: } if input != namedRef.Name() { diff --git a/internal/commands/tag/rm.go b/internal/commands/tag/rm.go index a6cd083..f4615c2 100644 --- a/internal/commands/tag/rm.go +++ b/internal/commands/tag/rm.go @@ -41,7 +41,7 @@ type rmOptions struct { force bool } -var ErrCanceled = errors.New("canceled") +var errCanceled = errors.New("canceled") func newRmCmd(streams command.Streams, hubClient *hub.Client, parent string) *cobra.Command { var opts rmOptions @@ -55,7 +55,7 @@ func newRmCmd(streams command.Streams, hubClient *hub.Client, parent string) *co }, RunE: func(cmd *cobra.Command, args []string) error { err := runRm(cmd.Context(), streams, hubClient, opts, args[0]) - if err == nil || err == ErrCanceled { + if err == nil || err == errCanceled { return nil } return err @@ -89,7 +89,7 @@ func runRm(ctx context.Context, streams command.Streams, hubClient *hub.Client, input := "" select { case <-ctx.Done(): - return ErrCanceled + return errCanceled case input = <-userIn: } if strings.ToLower(input) != "y" { diff --git a/internal/login/login.go b/internal/login/login.go index 5558f1b..2ed7d11 100644 --- a/internal/login/login.go +++ b/internal/login/login.go @@ -35,6 +35,7 @@ import ( "github.com/docker/hub-tool/internal/hub" ) +// ErrCanceled represents a normally canceled operation var ErrCanceled = errors.New("canceled") // RunLogin logs the user and asks for the 2FA code if needed