Skip to Content
marmot
DiagnosticsError codes
example $ marmot build .
error[M0007]: invalid operation: n + f (mismatched types int and float64)
 --> ./main.go:6:8
  |
4 |     var n int
  |         - `n` is `int` from here
5 |     var f float64
  |         - `f` is `float64` from here
6 |     _ = n + f
  |         - ^ - `float64`
  |         |
  |         `int`
  |
  = help: convert one operand, for example `float64(n) + f`

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

func main() {
	var n int
	var f float64
	_ = n + f
}

The mistake and the fix

The mistake
var n int
var f float64
_ = n + f
Fixed
_ = float64(n) + f 

The fix

Convert one operand to the type of the other.

See also all error codes and marmot explain.

On this page

Was this page helpful?

Report an issueOpen issues