From 07ce8bf79caaf9b29b7b96daae8b6462da41ca2b Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Mon, 9 May 2016 10:15:05 -0400 Subject: [PATCH] Cleaned up else per golint When an if ends in a return the else is not required. golint detects these conditions and found these. --- app.go | 14 ++++++-------- command.go | 9 ++++----- flag.go | 3 +-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app.go b/app.go index 6d1dd7b..7c9b958 100644 --- a/app.go +++ b/app.go @@ -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) { @@ -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 { diff --git a/command.go b/command.go index d40ca85..8950cca 100644 --- a/command.go +++ b/command.go @@ -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) diff --git a/flag.go b/flag.go index 4c3d174..1e8112e 100644 --- a/flag.go +++ b/flag.go @@ -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 }