From 5d0f3fb5ed7cd60e2d3014478ccbcd8ca23acf78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Serv=C3=A9n=20Mar=C3=ADn?= Date: Mon, 15 Feb 2021 12:48:28 +0100 Subject: [PATCH] builtins.go: fix builtinManifestJSONEx regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a regression in std.manifestJsonEx that caused the standard library function to error when the given value was an array. Signed-off-by: Lucas Servén Marín --- builtins.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/builtins.go b/builtins.go index 5e79292..615fdb1 100644 --- a/builtins.go +++ b/builtins.go @@ -1211,10 +1211,7 @@ func jsonEncode(v interface{}) (string, error) { // For backwards compatibility reasons, we are manually marshalling to json so we can control formatting // In the future, it might be apt to use a library [pretty-printing] function func builtinManifestJSONEx(i *interpreter, arguments []value) (value, error) { - obj, err := i.getObject(arguments[0]) - if err != nil { - return nil, err - } + val := arguments[0] vindent, err := i.getString(arguments[1]) if err != nil { @@ -1315,7 +1312,7 @@ func builtinManifestJSONEx(i *interpreter, arguments []value) (value, error) { } } - finalString, err := aux(obj, path, "") + finalString, err := aux(val, path, "") if err != nil { return nil, err }