From 0427706166678c24dd3fedeb5d25e4326d9eef85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Lipt=C3=A1k?= Date: Wed, 23 Nov 2016 20:18:50 -0500 Subject: [PATCH] Improve parsing of job struct --- jobspec/parse.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jobspec/parse.go b/jobspec/parse.go index f9defa7cf43..d0606ef2764 100644 --- a/jobspec/parse.go +++ b/jobspec/parse.go @@ -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]