From 8cfd3fd773221739eac578a10fc8bb1d75a7dc96 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Mon, 6 May 2019 13:14:51 +0800 Subject: [PATCH] fix increment-decrement lint error Kubernetes-commit: 142fe19f2d79e5bdd8fb7ac6a06e23012d1e8e6a --- util/jsonpath/jsonpath.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/util/jsonpath/jsonpath.go b/util/jsonpath/jsonpath.go index a5a8bbf7..78b6b678 100644 --- a/util/jsonpath/jsonpath.go +++ b/util/jsonpath/jsonpath.go @@ -93,17 +93,17 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) { // encounter an end node, break the current block if j.endRange > 0 && j.endRange <= j.inRange { - j.endRange -= 1 + j.endRange-- break } // encounter a range node, start a range loop if j.beginRange > 0 { - j.beginRange -= 1 - j.inRange += 1 + j.beginRange-- + j.inRange++ for k, value := range results { j.parser.Root.Nodes = nodes[i+1:] if k == len(results)-1 { - j.inRange -= 1 + j.inRange-- } nextResults, err := j.FindResults(value.Interface()) if err != nil { @@ -213,11 +213,11 @@ func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) ( switch node.Name { case "range": j.stack = append(j.stack, j.cur) - j.beginRange += 1 + j.beginRange++ results = input case "end": if j.endRange < j.inRange { // inside a loop, break the current block - j.endRange += 1 + j.endRange++ break } // the loop is about to end, pop value and continue the following execution