Conditional in the template

Published: Sunday, May 17, 2015 Last modified: Thursday, Nov 14, 2024

http://play.golang.org/p/QtqMIIQTj6

Note the weird conditional syntax, else you will have odd error messages like:

panic: template: foo:8:5: executing "foo" at <.Bar>: Bar has arguments but cannot be invoked as function