Standard library / go/ast
go/ast.NewIdent()
Constructs an identifier with the given name and no source position. It does not validate the spelling. Expected stdout: 'Total 0\n'.
Formal Syntax & Structure
go syntaxgo
func NewIdent(name string) *IdentParameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Identifier spelling. |
Return Value
*Ident
Constructs an identifier with the given name and no source position.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/ast")
func main() { x := ast.NewIdent("Total"); fmt.Println(x.Name, x.Pos()) }