The clean way to do this, in my opinion, is to make your item/element a type that knows whether it's failed or not.
https://play.golang.org/p/K_t8iEZvUc
You can also inject strings.Contains or similar using https://golang.org/pkg/html/template/#Template.Funcs
I wrote a tool that generates a simple web server from a JSON specification (https://github.com/goblimey/scaffolder). It makes heavy use of templates and they could have become horribly complicated. I avoided that using this technique.
Fundamentally, it's much easier to write logic in Go than in templatese, and, of course, you can write unit tests tocheck that it works.