github.com/dottorblaster/docker@v1.5.0/builder/parser/dumper/main.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 7 "github.com/docker/docker/builder/parser" 8 ) 9 10 func main() { 11 var f *os.File 12 var err error 13 14 if len(os.Args) < 2 { 15 fmt.Println("please supply filename(s)") 16 os.Exit(1) 17 } 18 19 for _, fn := range os.Args[1:] { 20 f, err = os.Open(fn) 21 if err != nil { 22 panic(err) 23 } 24 25 ast, err := parser.Parse(f) 26 if err != nil { 27 panic(err) 28 } else { 29 fmt.Println(ast.Dump()) 30 } 31 } 32 }