As noted in #28391, the documentation for template.IsTrue says:
IsTrue reports whether the value is 'true', in the sense of not the zero of its type, and whether the value has a meaningful truth value.
The zero time.Time is the zero of its type, so according to the documentation it should be considered to be true, but the implementation clearly intends otherwise:
|
case reflect.Struct: |
|
truth = true // Struct values are always true. |
Either the documentation should be clarified, or the behavior of IsTrue should be fixed to match what is documented. Probably the former.
As noted in #28391, the documentation for
template.IsTruesays:The zero
time.Timeis the zero of its type, so according to the documentation it should be considered to be true, but the implementation clearly intends otherwise:go/src/text/template/exec.go
Lines 326 to 327 in f6b554f
Either the documentation should be clarified, or the behavior of
IsTrueshould be fixed to match what is documented. Probably the former.