Standard library / go/types

go/types.Basic.Underlying()

Returns the basic type itself. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Basic) Underlying() Type

Return Value

Type

Returns the basic type itself.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() { fmt.Println(types.Typ[types.Int].Underlying() == types.Typ[types.Int]) }
Go Reference