Openshift GoLang 模板错误:无需指定资源,以资源/名称形式传递参数时键入单独的参数

Shu*_*osh 5 windows command-prompt go openshift go-templates

我在命令提示符中使用了以下脚本,但抛出错误:“无需指定资源,在以资源/名称形式传递参数时键入单独的参数。”

  oc get projects -o template --template '{{range .items}}{{.metadata.annotations "openshift.io/description"}}{{end}}
Run Code Online (Sandbox Code Playgroud)

这是截图

Ric*_*kow 1

假设您尝试使用go-template来调整输出,您的命令需要如下所示:

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

这里有一个关于如何使用 go-templateting 的很好的 OpenShift 博客