Standard library / go/types

go/types.Pointer.Underlying()

Returns the underlying type. An unnamed composite type is its own underlying type. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (p *Pointer) Underlying() Type

Return Value

Type

Returns the underlying type.

Working Example

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