Skip to content

Commit

Permalink
Cleaned up else per golint
Browse files Browse the repository at this point in the history
When an if ends in a return the else is not required. golint
detects these conditions and found these.
  • Loading branch information
mattfarina committed May 9, 2016
1 parent 2f110bd commit 07ce8bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
14 changes: 6 additions & 8 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,10 @@ func (a *App) Run(arguments []string) (err error) {
err := a.OnUsageError(context, err, false)
HandleExitCoder(err)
return err
} else {
fmt.Fprintf(a.Writer, "%s\n\n", "Incorrect Usage.")
ShowAppHelp(context)
return err
}
fmt.Fprintf(a.Writer, "%s\n\n", "Incorrect Usage.")
ShowAppHelp(context)
return err
}

if !a.HideHelp && checkHelp(context) {
Expand Down Expand Up @@ -310,11 +309,10 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
err = a.OnUsageError(context, err, true)
HandleExitCoder(err)
return err
} else {
fmt.Fprintf(a.Writer, "%s\n\n", "Incorrect Usage.")
ShowSubcommandHelp(context)
return err
}
fmt.Fprintf(a.Writer, "%s\n\n", "Incorrect Usage.")
ShowSubcommandHelp(context)
return err
}

if len(a.Commands) > 0 {
Expand Down
9 changes: 4 additions & 5 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,11 @@ func (c Command) Run(ctx *Context) (err error) {
err := c.OnUsageError(ctx, err, false)
HandleExitCoder(err)
return err
} else {
fmt.Fprintln(ctx.App.Writer, "Incorrect Usage.")
fmt.Fprintln(ctx.App.Writer)
ShowCommandHelp(ctx, c.Name)
return err
}
fmt.Fprintln(ctx.App.Writer, "Incorrect Usage.")
fmt.Fprintln(ctx.App.Writer)
ShowCommandHelp(ctx, c.Name)
return err
}

nerr := normalizeFlags(c.Flags, set)
Expand Down
3 changes: 1 addition & 2 deletions flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ func (f *IntSlice) Set(value string) error {
tmp, err := strconv.Atoi(value)
if err != nil {
return err
} else {
*f = append(*f, tmp)
}
*f = append(*f, tmp)
return nil
}

Expand Down

0 comments on commit 07ce8bf

Please sign in to comment.