Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · XO1106

Docs

XO1106: value with no Go value passed to Go as any

error · reported by the checker

A use go binding takes Go’s any as go.Any, an opaque Go value. go.any(x) makes one, and the elements of a list literal written for a List[go.Any] parameter of a Go binding’s function (Go’s ...any, as fmt.sprintf’s) convert implicitly as go.any(x) would. Only values with a Go form convert: the numbers, Bool, Str (string), Bytes ([]byte), Duration (time.Duration), Time (time.Time), a use go handle (its Go value), a go.Any, and a List, Map or Option of those. An enum, a struct, a closure or a capability has no Go value. Pass its fields, or a Str you format, instead. See core 2.10, 4.4 and decision 0412.

Example

use go "fmt"

enum Color { Red, Green }

fn show(c: Color) -> Str uses go {
  fmt.sprint([c])
}

Fix

use go "fmt"

enum Color { Red, Green }

fn show(c: Color) -> Str uses go {
  fmt.sprint(["${c:?}"])
}

Run xo explain XO1106 for this text in a terminal, or see section 10.6 of the specification.