mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-12-24 11:51:13 +08:00
feat: add helm to go mod (#497)
This commit is contained in:
17
vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go
vendored
17
vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go
vendored
@@ -70,12 +70,14 @@ func CreatePatch(a, b []byte) ([]Operation, error) {
|
||||
}
|
||||
var aI interface{}
|
||||
var bI interface{}
|
||||
err := json.Unmarshal(a, &aI)
|
||||
if err != nil {
|
||||
aDec := json.NewDecoder(bytes.NewReader(a))
|
||||
aDec.UseNumber()
|
||||
if err := aDec.Decode(&aI); err != nil {
|
||||
return nil, errBadJSONDoc
|
||||
}
|
||||
err = json.Unmarshal(b, &bI)
|
||||
if err != nil {
|
||||
bDec := json.NewDecoder(bytes.NewReader(b))
|
||||
bDec.UseNumber()
|
||||
if err := bDec.Decode(&bI); err != nil {
|
||||
return nil, errBadJSONDoc
|
||||
}
|
||||
return handleValues(aI, bI, "", []Operation{})
|
||||
@@ -94,6 +96,11 @@ func matchesValue(av, bv interface{}) bool {
|
||||
if ok && bt == at {
|
||||
return true
|
||||
}
|
||||
case json.Number:
|
||||
bt, ok := bv.(json.Number)
|
||||
if ok && bt == at {
|
||||
return true
|
||||
}
|
||||
case float64:
|
||||
bt, ok := bv.(float64)
|
||||
if ok && bt == at {
|
||||
@@ -212,7 +219,7 @@ func handleValues(av, bv interface{}, p string, patch []Operation) ([]Operation,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case string, float64, bool:
|
||||
case string, float64, bool, json.Number:
|
||||
if !matchesValue(av, bv) {
|
||||
patch = append(patch, NewOperation("replace", p, bv))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user