builtins.go: fix builtinManifestJSONEx regression

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 <lserven@gmail.com>
This commit is contained in:
Lucas Servén Marín 2021-02-15 12:48:28 +01:00 committed by Stanisław Barzowski
parent f742f2463e
commit 5d0f3fb5ed

View File

@ -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 // 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 // In the future, it might be apt to use a library [pretty-printing] function
func builtinManifestJSONEx(i *interpreter, arguments []value) (value, error) { func builtinManifestJSONEx(i *interpreter, arguments []value) (value, error) {
obj, err := i.getObject(arguments[0]) val := arguments[0]
if err != nil {
return nil, err
}
vindent, err := i.getString(arguments[1]) vindent, err := i.getString(arguments[1])
if err != nil { 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 { if err != nil {
return nil, err return nil, err
} }