explicitreturn/pkg/analyzer/testdata/example.go

24 lines
644 B
Go

package main
func SimpleNakedReturn() (x int, y string) {
return // want `implicit return found in function SimpleNakedReturn`
}
func IgnorableProcedure() {
return // No return values expected, all good here!
}
func SimpleFunction() (x int, y string) {
return x, y // Return values are as foretold in the function signature
}
func MultipleReturnPaths() (x int, y string) {
if true {
return x, y // All good here, but...
}
return // want `implicit return found in function MultipleReturnPaths`
}
// Also works on anonymous functions!
var x = func() (x int, y string) { return } // want `implicit return found in anonymous function`