Skip to content

errAborted is an empty error used as a control-flow signal #34

Description

@lefoulkrod
var errAborted = fmt.Errorf("")

It means "this command has already said what it needed to say, exit non-zero quietly". That is a reasonable thing to want, but expressing it as an error with no message makes the behaviour depend on nothing ever printing it — and something did: cobra printed Error: followed by an empty line, plus a full usage block, until that was fixed on the branch for #29's sibling work.

Suggestion

var errAborted = errors.New("aborted") — a real message, never printed because Execute checks errors.Is before printing. The name then says what it is, a stray print produces something legible instead of a bare prefix, and nothing depends on the message being empty.

Small, but it is the kind of thing that quietly grows a second bug on top of it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions