mirror of
https://github.com/safing/portbase
synced 2025-09-09 13:55:47 +00:00
Fix tests and linter warnings
This commit is contained in:
parent
7d2cd6c15d
commit
f59ad0357a
162 changed files with 668 additions and 696 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue