Go template provides an eq comparison operator, e.g., {{if eq .Var "val" }}.
What's the best way to do a case insensitive string comparison in this case? So that the above would be true for Var to be "val", "Val", or "VAL".
You can simply create another lowercase variable s1 := strings.ToLower(s) and to compare it with your template against a lowercase string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With