When you use range in a Golang html/template the "." variable changes to the current object from the range. We can however still access to old "." variable with "$": {{range $index, $emp := .employees}} {{ $emp.name }} {{ msg $ "btn_show" }} {{ end }}