mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-08 18:39:16 +00:00
[jsonpath] fix wrong output when using jsonpath
Fix range loop when using jsonpath Without patch: kubectl get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}' apiserver-7d9cc97649-79c2x is Running apiserver-7d9cc97649-lgks6 is Running apiserver-7d9cc97649-qgkxn is Running is Running With patch: kubectl get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}' apiserver-7d9cc97649-79c2x is Running apiserver-7d9cc97649-lgks6 is Running apiserver-7d9cc97649-qgkxn is Running Kubernetes-commit: 39cfe232325d66bcdbc935af7aaf7022562e7010
This commit is contained in:
committed by
Kubernetes Publisher
parent
9a82c6a51a
commit
b6d16d4e18
@@ -132,6 +132,9 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
|
||||
}
|
||||
continue
|
||||
}
|
||||
if len(results) == 0 {
|
||||
break
|
||||
}
|
||||
fullResult = append(fullResult, results)
|
||||
}
|
||||
return fullResult, nil
|
||||
|
Reference in New Issue
Block a user