Standard library / go/ast

go/ast.Ident.String()

Returns the spelling of the identifier; a nil receiver prints <nil>. Expected stdout: 'total\n'.

Formal Syntax & Structure

go syntaxgo
func (id *Ident) String() string

Return Value

string

Returns the spelling of the identifier; a nil receiver prints <nil>.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/ast")
func main() { fmt.Println(ast.NewIdent("total").String()) }
Go Reference