Standard library / go/types
go/types.NewTuple()
Constructs a tuple type descriptor. This does not allocate a runtime value. Expected stdout: '(x int)\n'.
Formal Syntax & Structure
go syntaxgo
func NewTuple(x ...*Var) *TupleParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | ...*Var | First type or expression to inspect. |
Return Value
*Tuple
Constructs a tuple type descriptor.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { fmt.Println(types.NewTuple(types.NewVar(0, nil, "x", types.Typ[types.Int]))) }