Skip to Content
marmot
DiagnosticsError codes
example $ marmot build .
error[M0012]: assignment mismatch: 1 variable but strconv.Atoi returns 2 values
 --> ./main.go:6:7
  |
6 |     n := strconv.Atoi("42")
  |          ^^^^^^^^^^^^ `strconv.Atoi` returns 2 values
  |
  = help: receive every result: `n, err := strconv.Atoi("42")`

error: build failed with 1 error
for more about an error, run `marmot explain M0012`
The program that produced it
package main

import "strconv"

func main() {
	n := strconv.Atoi("42")
	_ = n
}

The mistake and the fix

The mistake
n := strconv.Atoi(s)
Fixed
n, err := strconv.Atoi(s) 
if err != nil { 
	return err 
} 

The fix

Receive every result, using _ for the ones you do not need.

See also all error codes and marmot explain.

On this page

Was this page helpful?

Report an issueOpen issues