diff --git a/ignite/pkg/cache/cache.go b/ignite/pkg/cache/cache.go index 061818ed5c..02a6982167 100644 --- a/ignite/pkg/cache/cache.go +++ b/ignite/pkg/cache/cache.go @@ -91,10 +91,11 @@ func (c Cache[T]) Put(key string, value T) error { // Get fetches the value of key within the namespace. // If no value exists, it will return found == false. -func (c Cache[T]) Get(key string) (val T, err error) { +func (c Cache[T]) Get(key string) (T, error) { + var val T db, err := openDB(c.storage.storagePath) if err != nil { - return + return val, err } defer db.Close() diff --git a/ignite/pkg/jsonfile/jsonfile.go b/ignite/pkg/jsonfile/jsonfile.go index 0fb3b6a0a1..7ee796be6b 100644 --- a/ignite/pkg/jsonfile/jsonfile.go +++ b/ignite/pkg/jsonfile/jsonfile.go @@ -194,17 +194,14 @@ func (f *JSONFile) Field(key string, param interface{}) error { *paramStr = result break } - if _, ok := param.(interface{}); ok { - err := json.Unmarshal(value, param) - var unmarshalTypeError *json.UnmarshalTypeError - var syntaxTypeError *json.SyntaxError - if errors.As(err, &unmarshalTypeError) || - errors.As(err, &syntaxTypeError) { - return ErrInvalidValueType - } - break + var ( + unmarshalTypeError *json.UnmarshalTypeError + syntaxTypeError *json.SyntaxError + ) + if err := json.Unmarshal(value, param); errors.As(err, &unmarshalTypeError) || + errors.As(err, &syntaxTypeError) { + return ErrInvalidValueType } - return ErrInvalidValueType case jsonparser.NotExist: case jsonparser.Null: case jsonparser.Unknown: