Skip to Content
marmot
DiagnosticsError codes
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

The mistake
func add(a, b int) int

add(1, "two")
Fixed
add(1, 2) 

The fix

Convert the value, or change the declaration of the destination.

See also all error codes and marmot explain.

On this page

Was this page helpful?

Report an issueOpen issues