OpenShift "oc get pod -o go-template" with strings package

Latest response

Hello,
I would like to use strings.Contains function in an OpenShift OC command with option "-o go-template".
Is that possible? I see that only template package is maybe used.

I would like to search some values in the "oc get pods -o " command but even the jsonpath or go-template maybe does not know it.

I know that I can use {{if eq .metadata.name "podname"}}write something if yes{{else}}write something if no{{end}} but this can do only binary comparison not searching or contains. Like I need all podnames that contain word "myname".
I read the go-template docs and there is a string package that has function "Contains": https://pkg.go.dev/strings@go1.20.1#Contains

but how can I import this package?

Is it possible to do it somehow?

Thanks
Vlada

Responses