Skip to content

Commit 3535b9b

Browse files
Fix meshery#575: Replaced deprecated utils.Unmarshal and removed unused variables
1 parent 9c6bfaf commit 3535b9b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

config/provider/inmem.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package provider
1616

1717
import (
1818
"sync"
19-
19+
"encoding/json"
2020
"github.com/layer5io/meshkit/config"
2121
"github.com/layer5io/meshkit/utils"
2222
)
@@ -54,7 +54,8 @@ func (l *InMem) GetKey(key string) string {
5454
func (l *InMem) GetObject(key string, result interface{}) error {
5555
l.mutex.Lock()
5656
defer l.mutex.Unlock()
57-
return utils.Unmarshal(l.store[key], result)
57+
//return utils.Unmarshal(l.store[key], result)
58+
return json.Unmarshal([]byte(l.store[key]), result)
5859
}
5960

6061
// SetObject sets an object value for the key

utils/kubernetes/crd.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package kubernetes
22

33
import (
44
"context"
5+
"encoding/json"
56

6-
"github.com/layer5io/meshkit/utils"
77
"k8s.io/apimachinery/pkg/runtime/schema"
88
"k8s.io/client-go/rest"
99
)
@@ -35,7 +35,8 @@ func GetAllCustomResourcesInCluster(ctx context.Context, client rest.Interface)
3535
}
3636
var xcrd CRD
3737
gvks := []*schema.GroupVersionResource{}
38-
err = utils.Unmarshal(string(crdresult), &xcrd)
38+
//err = utils.Unmarshal(string(crdresult), &xcrd)
39+
err = json.Unmarshal(crdresult, &xcrd)
3940
if err != nil {
4041
return nil, err
4142
}

validator/validate.go

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
var (
1616
ErrValidateCode = ""
17-
schemaPath = "components.schemas"
1817
cueschema cue.Value
1918
mx sync.Mutex
2019
isSchemaLoaded bool

0 commit comments

Comments
 (0)