I just dived into an issue where I would like to assign an if condition to get a boolean stored in a certain variable. While I struggled receiving errors and had to make a dirty workaround.
What I’ve tried to do as I’m familiar with other Languages like PHP or JavaScript:
Long answer: The Go templates aren’t “full Go language syntax” – but ternaries isn’t available in “regular Go” either, which is one of the things I miss from other languages. So there are lots if small if/else in Go programs.
@rdwatters - indeed default would fit well in this case. I always wondered when this default function should be useful and forgot about it - thanks for re-enlightening