Standard library / go/types
go/types.Builtin.Pkg()
Returns the declaring package, or nil for predeclared objects. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (obj *Builtin) 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("len").(*types.Builtin); fmt.Println(v.Pkg() == nil) }