Standard library / go/types
go/types.Nil.Pkg()
Returns the declaring package, or nil for predeclared objects. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (obj *Nil) Pkg() *PackageReturn Value
*Package
Returns the declaring package, or nil for predeclared objects.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { v := types.Universe.Lookup("nil").(*types.Nil); fmt.Println(v.Pkg() == nil) }