// exists returns true if it would be possible to call the index function // with these arguments. // // TODO: how to document this for users? // // index returns the result of indexing its first argument by the following // arguments. Thus "index x 1 2 3" is, in Go syntax, x[1][2][3]. Each // indexed item must be a map, slice, or array. func exists(item interface{ … } // stolen from text/template // indirect returns the item at the end of indirection, and a bool to indicate if it's nil. // We indirect through pointers and empty interfaces (only) because // non-empty interfaces have methods we might need. func indirect(v reflect.Value) (rv reflect.Value, isNil bool) { … } type JSONPathPrinter … func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error) { … } // PrintObj formats the obj with the JSONPath Template. func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error { … }