templatesgorevel

Error: "invalid type for comparison" in revel template


After creating multple endpoints customizing footer.html, I end up with this error for not apparent this don't effect the functionally of the application, just annoying me. Tried:

  revel run revel_app or dev

Revel Template Execution Error

: executing "footer.html" at : error calling eq: invalid type for comparison.

  {{if eq .RunMode "dev"}}

  {{template "debug.html" .}}

  {{end}}
 </body>

</html>

Solution

  • The error you see arises when one of the arguments to eq is either undefined in the current context or is not of a "basic type" (see the last paragraph of this section)

    So assuming that footer.html is a "pratial" template that is associated with other templates which invoke the footer template using the template action you need to ensure that the context passed in to the template invocation contains the .RunMode value and that the value is of a basic type.