Standard library / go/types

go/types.Unalias()

Follows alias types to the first non-alias type. Expected stdout: 'int\n'.

Formal Syntax & Structure

go syntaxgo
func Unalias(t Type) Type

Parameters & Attributes

NameTypeDescription
tTypeType to inspect or normalize.

Return Value

Type

Follows alias types to the first non-alias type.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() {  obj := types.NewTypeName(0, nil, "Alias", nil)  x := types.NewAlias(obj, types.Typ[types.Int])  fmt.Println(types.Unalias(x))}
Go Reference