Standard library / go/types

go/types.Nil.Parent()

Returns the declaring scope, or nil for methods and struct fields. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (obj *Nil) Parent() *Scope

Return 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("nil").(*types.Nil); fmt.Println(v.Parent() != nil) }
Go Reference