feat: add helm to go mod (#497)

This commit is contained in:
naison
2025-03-30 11:52:21 +08:00
committed by GitHub
parent a030dc582b
commit d191c927f4
2687 changed files with 190853 additions and 78174 deletions

View File

@@ -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))
}