Standard library / go/types
go/types.Nil.Type()
Returns the associated type; builtins and import names do not have ordinary value types. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (obj *Nil) Type() TypeReturn Value
Type
Returns the associated type; builtins and import names do not have ordinary value types.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { v := types.Universe.Lookup("nil").(*types.Nil); fmt.Println(v.Type() != nil) }