Skip to Content
marmot
DiagnosticsError codes
example $ marmot build .
error[M0001]: expected operand, found '}'
 --> ./main.go:5:1
  |
4 |     x := 1 +
  |            - this expression is not finished
5 | }
  | ^ expected an operand here

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

func main() {
	x := 1 +
}

The position is where the parser gave up, which is often just after the real mistake: look at the end of the previous line for a missing bracket, comma or operand.

The mistake and the fix

The mistake
func main() {
	x := 1 +
}
Fixed
func main() {
	x := 1 + 2
	_ = x 
}

The fix

Complete the expression or statement, or close the open bracket.

See also all error codes and marmot explain.

On this page

Was this page helpful?

Report an issueOpen issues