Standard library / go/types
go/types.Builtin.Parent()
Returns the declaring scope, or nil for methods and struct fields. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (obj *Builtin) Parent() *ScopeReturn Value
*Scope
Returns the declaring scope, or nil for methods and struct fields.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { v := types.Universe.Lookup("len").(*types.Builtin); fmt.Println(v.Parent() != nil) }