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) *Tuple

Parameters & Attributes

NameTypeDescription
x...*VarFirst 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]))) }
Go Reference