windowsgoopenshiftcommand-promptgo-templates

Openshift GoLang template error: there is no need to specify a resource, type as a separate argument when passing arguments in resource/name form


I have used the below script in command prompt but is throwing error: "there is no need to specify a resource, type as a separate argument when passing arguments in resource/name form."

  oc get projects -o template --template '{{range .items}}{{.metadata.annotations "openshift.io/description"}}{{end}}

This is the screenshot


Solution

  • Assuming that you are trying to use go-template to adjust your output, your command needs to looks like follows:

    oc get projects -o go-template='{{range .items}}{{.metadata.annotations "openshift.io/description"}}{{end}}

    There is a good OpenShift blog on how to work with go-templating here