Standard library / go/types

go/types.TypeAndValue.IsBuiltin()

Reports whether the expression denotes a built-in function. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (tv TypeAndValue) IsBuiltin() bool

Return Value

bool

Reports whether the expression denotes a built-in function.

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, "len")  check(e)  fmt.Println(tv.IsBuiltin())}
Go Reference