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