DiagnosticsError codes
M0006 type mismatch
A value of one type is used where another type is required: as a function argument, in an assignment, in a return statement, or in a composite literal.
example $ marmot build . error[M0006]: cannot use "two" (untyped string constant) as int value in argument to add --> ./main.go:7:9 | 3 | func add(a, b int) int | --- expected because of parameter `b` ... 7 | add(1, "two") | ^^^^^ expected `int`, found `untyped string` | = help: to parse a number from text, use `strconv.Atoi("two")` error: build failed with 1 error for more about an error, run `marmot explain M0006`
The program that produced it
package main
func add(a, b int) int
func main() {
add(1, "two")
}
The mistake and the fix
func add(a, b int) int
add(1, "two")add(1, 2) The fix
Convert the value, or change the declaration of the destination.
See also all error codes and marmot explain.