DiagnosticsError codes
M0008 wrong number of return values
The return statement gives a different number of values than the function signature declares.
example $ marmot build . error[M0008]: too many return values --> ./main.go:4:9 | 3 | func main() { | ----------- `main` declares no results 4 | return 1 | ^ returns a value | = note: expected `()`, found `(number)` error: build failed with 1 error for more about an error, run `marmot explain M0008`
The program that produced it
package main
func main() {
return 1
}
The mistake and the fix
func main() {
return 1
}func f() int {
return 1
}The fix
Return exactly the values in the signature, or change the signature.
See also all error codes and marmot explain.