Skip to content

Commit 1e3bba5

Browse files
committed
Add comment about cmd.Help()
The linter picked up that the error value from cmd.Help() isn't checked. Even though cmd.Help() returns an error value, it's always nil. The inner HelpFunc() function directly prints the error message instead of returning an error value.
1 parent 558ff2d commit 1e3bba5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/gh/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func mainRun() exitCode {
173173
lastArgument := expandedArgs[len(expandedArgs)-1]
174174
askingForHelp := lastArgument == "--help" || lastArgument == "-h"
175175
if askingForHelp {
176+
// Even though cmd.Help() returns an error, the error value is
177+
// always nil. The inner function HelpFunc() prints an error
178+
// directly if something's wrong with the text template, rather than
179+
// returning the error value.
176180
cmd.Help()
177181
return exitOK
178182
}

0 commit comments

Comments
 (0)