diff --git a/cli/inspect/inspector.go b/cli/inspect/inspector.go index 0d275c4161..b2112ce78f 100644 --- a/cli/inspect/inspector.go +++ b/cli/inspect/inspector.go @@ -41,6 +41,9 @@ func NewTemplateInspectorFromString(out io.Writer, tmplStr string) (Inspector, e if tmplStr == "" { return NewIndentedInspector(out), nil } + if strings.Contains(tmplStr, ".Id") { + tmplStr = strings.Replace(tmplStr, ".Id", ".ID", -1) + } tmpl, err := templates.Parse(tmplStr) if err != nil { diff --git a/cli/inspect/inspector_test.go b/cli/inspect/inspector_test.go index 550f21de52..e8d602fa8f 100644 --- a/cli/inspect/inspector_test.go +++ b/cli/inspect/inspector_test.go @@ -193,11 +193,20 @@ func TestInspect(t *testing.T) { }, wantOut: "\n", wantErr: false, + }, { + name: "testInspectTemplate{{.Id}}", + args: args{ + references: []string{"reference"}, + tmplStr: "{{.Id}}", + getRef: getRefFunc, + }, + wantOut: "id", + wantErr: false, }, { name: "testInspectTemplateError", args: args{ references: []string{"single reference"}, - tmplStr: "{{.Id}}", + tmplStr: "{{.id}}", getRef: getRefFunc, }, wantOut: "",