You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, say that the result of foo here is never used, as it's always called like foo() or _ = foo():
func foo() bar {
if cond {
return foo2()
}
return foo3()
}
However, following unparam's advice to remove the result parameter will make the code longer:
func foo() {
if cond {
foo2()
return
}
foo3()
}
A couple of examples from go version devel +4a52452a2f Wed Feb 28 22:05:23 2018 +0000 linux/amd64:
regexp/syntax/parse.go:297:27: (*parser).concat - result 0 (*regexp/syntax.Regexp) is never used
regexp/syntax/parse.go:317:30: (*parser).alternate - result 0 (*regexp/syntax.Regexp) is never used
The text was updated successfully, but these errors were encountered:
The rule here should probably be "can all return call() lines be rewritten as call() without changing the behavior?". That will only be true if there is a single return, and it is at the end of the main block.
For example, say that the result of
foo
here is never used, as it's always called likefoo()
or_ = foo()
:However, following unparam's advice to remove the result parameter will make the code longer:
A couple of examples from
go version devel +4a52452a2f Wed Feb 28 22:05:23 2018 +0000 linux/amd64
:The text was updated successfully, but these errors were encountered: