no-naked-return
Default severity: warning
Reports a bare return when the nearest function declaration or function
literal has at least one named result. Naked returns make data flow implicit:
the reader must search backward to determine which values are returned.
func value() (result int) { result = calculate() return}func value() (result int) { result = calculate() return result}The rule does not require removing named results. It only requires the return statement to name the values being returned.
Configuration
Section titled “Configuration”[checks.rules.no-naked-return]severity = "warning"excludes = ["generated/**"]