Improve parsing of job struct

This commit is contained in:
Gábor Lipták
2016-11-23 20:18:50 -05:00
parent 3e6390839f
commit 0427706166

View File

@@ -84,10 +84,13 @@ func ParseFile(path string) (*structs.Job, error) {
}
func parseJob(result *structs.Job, list *ast.ObjectList) error {
list = list.Children()
if len(list.Items) != 1 {
return fmt.Errorf("only one 'job' block allowed")
}
list = list.Children()
if len(list.Items) != 1 {
return fmt.Errorf("'job' block missing name")
}
// Get our job object
obj := list.Items[0]