Standard library / go/types

go/types.Map.Key()

Map key type. Expected stdout: 'string\n'.

Formal Syntax & Structure

go syntaxgo
func (m *Map) Key() Type

Return Value

Type

Map key 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.Key()) }
Go Reference