From 8fd1a3cbdb01d77686958e1b5f6604ef53a87e9e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 9 May 2017 23:40:27 +0100 Subject: [PATCH] metadata: Fix parsing of JSON `ok` was not assigned when type casting to `map[string]interface{}` so the subsequent check was testing a stale value. Also, the error message upon failure had the wrong sense. Signed-off-by: Ian Campbell --- pkg/metadata/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/metadata/main.go b/pkg/metadata/main.go index b6de5918b..8484aea7e 100644 --- a/pkg/metadata/main.go +++ b/pkg/metadata/main.go @@ -167,9 +167,9 @@ func processUserData(data []byte) error { continue } for f, i := range files { - fi := i.(map[string]interface{}) + fi, ok := i.(map[string]interface{}) if !ok { - log.Printf("Could convert JSON for items: %s", i) + log.Printf("Couldn't convert JSON for items: %s", i) continue } if _, ok := fi["perm"]; !ok {