Fix tests and linter warnings

This commit is contained in:
Daniel 2022-02-01 13:12:46 +01:00
parent 7d2cd6c15d
commit f59ad0357a
162 changed files with 668 additions and 696 deletions

View file

@ -27,11 +27,11 @@ func (ja *JSONBytesAccessor) Set(key string, value interface{}) error {
}
}
new, err := sjson.SetBytes(*ja.json, key, value)
newJSON, err := sjson.SetBytes(*ja.json, key, value)
if err != nil {
return err
}
*ja.json = new
*ja.json = newJSON
return nil
}
@ -60,15 +60,15 @@ func (ja *JSONBytesAccessor) GetStringArray(key string) (value []string, ok bool
return nil, false
}
slice := result.Array()
new := make([]string, len(slice))
sliceCopy := make([]string, len(slice))
for i, res := range slice {
if res.Type == gjson.String {
new[i] = res.String()
sliceCopy[i] = res.String()
} else {
return nil, false
}
}
return new, true
return sliceCopy, true
}
// GetInt returns the int found by the given json key and whether it could be successfully extracted.