Skip to content

Commit

Permalink
Fix meshery#575: Replaced deprecated utils.Unmarshal and removed unus…
Browse files Browse the repository at this point in the history
…ed variables
  • Loading branch information
ShivanshuGupta07 committed Aug 25, 2024
1 parent 9c6bfaf commit 3535b9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions config/provider/inmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package provider

import (
"sync"

"encoding/json"
"github.com/layer5io/meshkit/config"
"github.com/layer5io/meshkit/utils"
)
Expand Down Expand Up @@ -54,7 +54,8 @@ func (l *InMem) GetKey(key string) string {
func (l *InMem) GetObject(key string, result interface{}) error {
l.mutex.Lock()
defer l.mutex.Unlock()
return utils.Unmarshal(l.store[key], result)
//return utils.Unmarshal(l.store[key], result)
return json.Unmarshal([]byte(l.store[key]), result)
}

// SetObject sets an object value for the key
Expand Down
5 changes: 3 additions & 2 deletions utils/kubernetes/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package kubernetes

import (
"context"
"encoding/json"

"github.com/layer5io/meshkit/utils"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
)
Expand Down Expand Up @@ -35,7 +35,8 @@ func GetAllCustomResourcesInCluster(ctx context.Context, client rest.Interface)
}
var xcrd CRD
gvks := []*schema.GroupVersionResource{}
err = utils.Unmarshal(string(crdresult), &xcrd)
//err = utils.Unmarshal(string(crdresult), &xcrd)
err = json.Unmarshal(crdresult, &xcrd)
if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion validator/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

var (
ErrValidateCode = ""
schemaPath = "components.schemas"
cueschema cue.Value
mx sync.Mutex
isSchemaLoaded bool
Expand Down

0 comments on commit 3535b9b

Please sign in to comment.