Standard library / go/types
go/types.NewPointer()
Constructs a pointer type descriptor. This does not allocate a runtime value. Expected stdout: '*int\n'.
Formal Syntax & Structure
go syntaxgo
func NewPointer(elem Type) *PointerParameters & Attributes
| Name | Type | Description |
|---|---|---|
| elem | Type | Element type. |
Return Value
*Pointer
Constructs a pointer type descriptor.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { fmt.Println(types.NewPointer(types.Typ[types.Int])) }