diff --git a/src/template/text.go b/src/template/text.go index 42dfed5c..944a9366 100644 --- a/src/template/text.go +++ b/src/template/text.go @@ -82,6 +82,9 @@ func (t *Text) cleanTemplate() { } knownVariable := func(variable string) bool { + if variable == "." { + return true + } variable = strings.TrimPrefix(variable, ".") splitted := strings.Split(variable, ".") if len(splitted) == 0 { diff --git a/src/template/text_test.go b/src/template/text_test.go index 30c721d2..b02e0116 100644 --- a/src/template/text_test.go +++ b/src/template/text_test.go @@ -225,6 +225,11 @@ func TestCleanTemplate(t *testing.T) { Expected string Template string }{ + { + Case: "Literal dot", + Expected: "hello . what's up", + Template: "hello . what's up", + }, { Case: "Variable", Expected: "{{range $cpu := .Data.CPU}}{{round $cpu.Mhz 2 }} {{end}}",