mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
755be795b4
Signed-off-by: John Howard <jhoward@microsoft.com> Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
35 lines
538 B
Go
35 lines
538 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/docker/docker/builder/dockerfile/parser"
|
|
)
|
|
|
|
func main() {
|
|
var f *os.File
|
|
var err error
|
|
|
|
if len(os.Args) < 2 {
|
|
fmt.Println("please supply filename(s)")
|
|
os.Exit(1)
|
|
}
|
|
|
|
for _, fn := range os.Args[1:] {
|
|
f, err = os.Open(fn)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
d := parser.Directive{LookingForDirectives: true}
|
|
parser.SetEscapeToken(parser.DefaultEscapeToken, &d)
|
|
|
|
ast, err := parser.Parse(f, &d)
|
|
if err != nil {
|
|
panic(err)
|
|
} else {
|
|
fmt.Println(ast.Dump())
|
|
}
|
|
}
|
|
}
|