Standard library / go/types

go/types.Tuple.String()

Returns a diagnostic string representation of the type. Expected stdout: '(x int)\n'.

Formal Syntax & Structure

go syntaxgo
func (t *Tuple) String() string

Return Value

string

Returns a diagnostic string representation of the type.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() {  t := types.NewTuple(types.NewVar(0, nil, "x", types.Typ[types.Int]))  fmt.Println(t.String())}
Go Reference