Skip to content

E0110: Misplaced ? ​

f()? returns early with the error (or the empty Option) and is otherwise the value. It must end its own statement (x := f()?, return f()?, f()?), can't be in an if/for/switch header, and needs the function to return what it passes on: an error last or a Result for errors, an Option for an Option.

Wrong ​

vuka
func parse(s string) int {
	n := strconv.Atoi(s)?
	return n
}
vuka
func parse(s string) (int, error) {
	n := strconv.Atoi(s)?
	return n, nil
}

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.