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) TypeParameters & Attributes
| Name | Type | Description |
|---|---|---|
| t | Type | Type 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))}