Failing a build from template function

Looking at, I’m thinking about doing something along the lines of:

func (ns *Namespace) Errorf(format string, a ...interface{}) string {
    jww.ERROR.Printf(format, a...)
    // fail build somehow here

However, I’m unsure how to best go about killing the build process. The thought of panic() crossed my mind, but I’m not confident that’s the correct solution.

Also, are there nuances I should be wary of? Something that jumps to mind would be perhaps a template tag cache which could interfere with the intended effect.

I will comment on the issue.