Standard library / go/types
go/types.TypeAndValue.IsType()
Reports whether the expression denotes a type. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (tv TypeAndValue) IsType() boolReturn Value
bool
Reports whether the expression denotes a type.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/token" "go/types")
func check(e error) { if e != nil { panic(e) }}
func main() { tv, e := types.Eval(token.NewFileSet(), nil, 0, "int") check(e) fmt.Println(tv.IsType())}