Standard library / go/token

go/token.Token.String()

Returns operator or keyword spelling, or a descriptive token-class name. Expected stdout: ':= IDENT\n'.

Formal Syntax & Structure

go syntaxgo
func (tok Token) String() string

Return Value

string

Returns operator or keyword spelling, or a descriptive token-class name.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/token")
func main() { fmt.Println(token.DEFINE.String(), token.IDENT.String()) }
Go Reference