Skip to content

Instantly share code, notes, and snippets.

@campoy
Created December 18, 2017 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save campoy/14b8b36984be105b051ae863a12fcd60 to your computer and use it in GitHub Desktop.
Save campoy/14b8b36984be105b051ae863a12fcd60 to your computer and use it in GitHub Desktop.
package main
import (
"go/parser"
"go/token"
"log"
"github.com/davecgh/go-spew/spew"
)
func main() {
fs := token.NewFileSet()
f, err := parser.ParseFile(fs, "", "package main; var a = 3", parser.AllErrors)
if err != nil {
log.Fatal(err)
}
spew.Dump(f)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment