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() string

Return 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()) }
Go Reference