Standard library / go/types
go/types.Basic.Name()
Returns the basic type name. Expected stdout: 'int\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Basic) Name() stringReturn Value
string
Returns the basic type name.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { fmt.Println(types.Typ[types.Int].Name()) }