package main import ( "fmt" "go/types" ) type myInt int func main() { var x myInt = 42 xType := types.NewNamed( types.NewTypeName(0, nil, "myInt", types.Typ[types.Int]), types.Typ[types.Int], nil, ) fmt.Println(xType.Underlying() == types.Typ[types.Int]) }In this example, we define a custom type called `myInt` which is simply an alias for the built-in `int` type. We then create a new `types.Named` instance that represents the `myInt` type, and pass it to the `Underlying()` method to get its underlying type. We compare this underlying type to the `int` type to verify that it is the same. The package library for Type Underlying is go.tools.go.types.