Standard library / reflect
reflect.PtrTo()
Historical spelling of PointerTo; prefer PointerTo in new code. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func PtrTo(t Type) TypeParameters & Attributes
| Name | Type | Description |
|---|---|---|
| t | Type | Element type of the new composite type. |
Return Value
Type
Historical spelling of PointerTo; prefer PointerTo in new code.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { t := reflect.TypeOf(0); fmt.Println(reflect.PtrTo(t) == reflect.PointerTo(t)) }