Standard library / go/parser
go/parser.DeclarationErrors
Reports declaration errors from deprecated object resolution. Prefer go/types for semantic checks. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
const DeclarationErrors Mode = 16Working Example
Example Snippetgo
package main
import ( "fmt" "go/parser" "go/token")
func main() { _, e := parser.ParseFile(token.NewFileSet(), "demo.go", "package demo; var x,x int", parser.DeclarationErrors) fmt.Println(e != nil)}