Standard library / go/types
go/types.TypeAndValue.IsVoid()
Reports whether the expression is a call with no result. Expected stdout: 'false\n'.
Formal Syntax & Structure
go syntaxgo
func (tv TypeAndValue) IsVoid() boolReturn Value
bool
Reports whether the expression is a call with no result.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/token" "go/types")
func check(e error) { if e != nil { panic(e) }}
func main() { tv, e := types.Eval(token.NewFileSet(), nil, 0, "2+3") check(e) fmt.Println(tv.IsVoid())}