Merge pull request #68442 from CaoShuFeng/json-patch

vendor: bump github.com/evanphx/json-patch
pull/8/head
k8s-ci-robot 2018-09-12 15:05:03 -07:00 committed by GitHub
commit 9cf822183f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 21 deletions

4
Godeps/Godeps.json generated
View File

@ -1542,8 +1542,8 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Comment": "v3.0.0-29-gf195058",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Comment": "v3.0.0-34-g36442db",
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/exponent-io/jsonpath",

View File

@ -388,7 +388,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -24,7 +24,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -388,7 +388,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -12,7 +12,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -128,7 +128,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -120,7 +120,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -8,7 +8,7 @@
"Deps": [
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb"
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4"
},
{
"ImportPath": "github.com/ghodss/yaml",

View File

@ -15,7 +15,7 @@ go get -u github.com/evanphx/json-patch
```
**Stable Versions**:
* Version 3: `go get -u gopkg.in/evanphx/json-patch.v3`
* Version 4: `go get -u gopkg.in/evanphx/json-patch.v4`
(previous versions below `v3` are unavailable)

View File

@ -236,7 +236,7 @@ func (o operation) path() string {
}
func (o operation) from() string {
if obj, ok := o["from"]; ok && obj != nil{
if obj, ok := o["from"]; ok && obj != nil {
var op string
err := json.Unmarshal(*obj, &op)
@ -389,17 +389,13 @@ func (d *partialArray) add(key string, val *lazyNode) error {
cur := *d
if idx < 0 {
idx *= -1
if idx > len(ary) {
return fmt.Errorf("Unable to access invalid index: %d", idx)
}
idx = len(ary) - idx
}
if idx < 0 || idx >= len(ary) || idx > len(cur) {
if idx < -len(ary) || idx >= len(ary) {
return fmt.Errorf("Unable to access invalid index: %d", idx)
}
if idx < 0 {
idx += len(ary)
}
copy(ary[0:idx], cur[0:idx])
ary[idx] = val
copy(ary[idx+1:], cur[idx:])
@ -430,9 +426,12 @@ func (d *partialArray) remove(key string) error {
cur := *d
if idx >= len(cur) {
if idx < -len(cur) || idx >= len(cur) {
return fmt.Errorf("Unable to remove invalid index: %d", idx)
}
if idx < 0 {
idx += len(cur)
}
ary := make([]*lazyNode, len(cur)-1)
@ -535,6 +534,8 @@ func (p Patch) test(doc *container, op operation) error {
return nil
}
return fmt.Errorf("Testing value %s failed", path)
} else if op.value() == nil {
return fmt.Errorf("Testing value %s failed", path)
}
if val.equal(op.value()) {