-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from mattfarina/cleanup
Code cleanup from Go Report Card
- Loading branch information
Showing
12 changed files
with
146 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ func ExampleApp_Run() { | |
app.UsageText = "app [first_arg] [second_arg]" | ||
app.Author = "Harrison" | ||
app.Email = "[email protected]" | ||
app.Authors = []Author{Author{Name: "Oliver Allen", Email: "[email protected]"}} | ||
app.Authors = []Author{{Name: "Oliver Allen", Email: "[email protected]"}} | ||
app.Run(os.Args) | ||
// Output: | ||
// Hello Jeremy | ||
|
@@ -307,12 +307,12 @@ func TestApp_CommandWithNoFlagBeforeTerminator(t *testing.T) { | |
func TestApp_VisibleCommands(t *testing.T) { | ||
app := NewApp() | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "frob", | ||
HelpName: "foo frob", | ||
Action: func(_ *Context) error { return nil }, | ||
}, | ||
Command{ | ||
{ | ||
Name: "frib", | ||
HelpName: "foo frib", | ||
Hidden: true, | ||
|
@@ -517,7 +517,7 @@ func TestApp_BeforeFunc(t *testing.T) { | |
} | ||
|
||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "sub", | ||
Action: func(c *Context) error { | ||
counts.Total++ | ||
|
@@ -609,7 +609,7 @@ func TestApp_AfterFunc(t *testing.T) { | |
} | ||
|
||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "sub", | ||
Action: func(c *Context) error { | ||
counts.Total++ | ||
|
@@ -724,7 +724,7 @@ func TestApp_CommandNotFound(t *testing.T) { | |
} | ||
|
||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "bar", | ||
Action: func(c *Context) error { | ||
counts.Total++ | ||
|
@@ -791,7 +791,7 @@ func TestApp_OrderOfOperations(t *testing.T) { | |
|
||
app.After = afterNoError | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "bar", | ||
Action: func(c *Context) error { | ||
counts.Total++ | ||
|
@@ -1126,15 +1126,15 @@ func TestApp_Run_Categories(t *testing.T) { | |
app := NewApp() | ||
app.Name = "categories" | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "command1", | ||
Category: "1", | ||
}, | ||
Command{ | ||
{ | ||
Name: "command2", | ||
Category: "1", | ||
}, | ||
Command{ | ||
{ | ||
Name: "command3", | ||
Category: "2", | ||
}, | ||
|
@@ -1175,32 +1175,32 @@ func TestApp_VisibleCategories(t *testing.T) { | |
app := NewApp() | ||
app.Name = "visible-categories" | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "command1", | ||
Category: "1", | ||
HelpName: "foo command1", | ||
Hidden: true, | ||
}, | ||
Command{ | ||
{ | ||
Name: "command2", | ||
Category: "2", | ||
HelpName: "foo command2", | ||
}, | ||
Command{ | ||
{ | ||
Name: "command3", | ||
Category: "3", | ||
HelpName: "foo command3", | ||
}, | ||
} | ||
|
||
expected := []*CommandCategory{ | ||
&CommandCategory{ | ||
{ | ||
Name: "2", | ||
Commands: []Command{ | ||
app.Commands[1], | ||
}, | ||
}, | ||
&CommandCategory{ | ||
{ | ||
Name: "3", | ||
Commands: []Command{ | ||
app.Commands[2], | ||
|
@@ -1214,27 +1214,27 @@ func TestApp_VisibleCategories(t *testing.T) { | |
app = NewApp() | ||
app.Name = "visible-categories" | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "command1", | ||
Category: "1", | ||
HelpName: "foo command1", | ||
Hidden: true, | ||
}, | ||
Command{ | ||
{ | ||
Name: "command2", | ||
Category: "2", | ||
HelpName: "foo command2", | ||
Hidden: true, | ||
}, | ||
Command{ | ||
{ | ||
Name: "command3", | ||
Category: "3", | ||
HelpName: "foo command3", | ||
}, | ||
} | ||
|
||
expected = []*CommandCategory{ | ||
&CommandCategory{ | ||
{ | ||
Name: "3", | ||
Commands: []Command{ | ||
app.Commands[2], | ||
|
@@ -1248,19 +1248,19 @@ func TestApp_VisibleCategories(t *testing.T) { | |
app = NewApp() | ||
app.Name = "visible-categories" | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "command1", | ||
Category: "1", | ||
HelpName: "foo command1", | ||
Hidden: true, | ||
}, | ||
Command{ | ||
{ | ||
Name: "command2", | ||
Category: "2", | ||
HelpName: "foo command2", | ||
Hidden: true, | ||
}, | ||
Command{ | ||
{ | ||
Name: "command3", | ||
Category: "3", | ||
HelpName: "foo command3", | ||
|
@@ -1296,9 +1296,9 @@ func TestApp_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) { | |
func TestApp_Run_SubcommandDoesNotOverwriteErrorFromBefore(t *testing.T) { | ||
app := NewApp() | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Subcommands: []Command{ | ||
Command{ | ||
{ | ||
Name: "sub", | ||
}, | ||
}, | ||
|
@@ -1336,7 +1336,7 @@ func TestApp_OnUsageError_WithWrongFlagValue(t *testing.T) { | |
return errors.New("intercepted: " + err.Error()) | ||
} | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "bar", | ||
}, | ||
} | ||
|
@@ -1366,7 +1366,7 @@ func TestApp_OnUsageError_WithWrongFlagValue_ForSubcommand(t *testing.T) { | |
return errors.New("intercepted: " + err.Error()) | ||
} | ||
app.Commands = []Command{ | ||
Command{ | ||
{ | ||
Name: "bar", | ||
}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.