-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
dependenciesRelates to an upstream dependencyRelates to an upstream dependencystaleNo recent correspondence or work activityNo recent correspondence or work activity
Description
The nakedret linter embedded in golangci-lint appears to only check for "return" statements at the top level of the function, outside of conditionals. My expectation is that all returns are checked in functions above the specified length, regardless of nesting.
In golangci-lint's test suite, should line 6 of test/testdata/nakedret.go have an "// ERROR" marker? Letting the first "return" pass here seems wrong:
func NakedretIssue() (a int, b string) {
if a > 0 {
return
}
if b == "" {
return 0, "0"
}
[...]
return // ERROR "naked return in func `NakedretIssue` with 31 lines of code"
}
Thanks!
-- Aaron
Metadata
Metadata
Assignees
Labels
dependenciesRelates to an upstream dependencyRelates to an upstream dependencystaleNo recent correspondence or work activityNo recent correspondence or work activity