Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Error out if "-f" option not given or if the supplied file
cannot be parsed.
  • Loading branch information
jake-scott committed Feb 23, 2020
1 parent 2a048b4 commit 2fb59cc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func main() {
parserMode = parser.ImportsOnly
}

if *file == "" {
reportError(fmt.Errorf("Must supply the -f option"))
os.Exit(1)
}

var fileAst *ast.File
var err error

Expand All @@ -56,6 +61,7 @@ func main() {

if err != nil {
reportError(fmt.Errorf("Could not parse file %s", *file))
os.Exit(1)
}

declarations := []Declaration{}
Expand Down

0 comments on commit 2fb59cc

Please sign in to comment.