Skip to content

Commit

Permalink
fix more lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani authored and Pantani committed Oct 16, 2023
1 parent e9d0b61 commit d42a596
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
5 changes: 3 additions & 2 deletions ignite/pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
17 changes: 7 additions & 10 deletions ignite/pkg/jsonfile/jsonfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d42a596

Please sign in to comment.