Standard library / go/types

go/types.Map.String()

Returns a diagnostic string representation of the type. Expected stdout: 'map[string]int\n'.

Formal Syntax & Structure

go syntaxgo
func (t *Map) 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.NewMap(types.Typ[types.String], types.Typ[types.Int])  fmt.Println(t.String())}
Go Reference