1
0
mirror of https://github.com/golang/go synced 2024-09-25 11:20:13 -06:00

html/template: use named consts instead of their values

Use defined named constants instead of 0 literal in comparisons.

Found using https://go-critic.github.io/overview.html#namedConst-ref

Change-Id: Ic075cece248f6e51db0b3d9d9eaba7d6409c9eef
Reviewed-on: https://go-review.googlesource.com/123376
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Iskander Sharipov 2018-07-11 23:36:55 +03:00 committed by Brad Fitzpatrick
parent ca8ba0675a
commit 48462bb3c0

View File

@ -48,19 +48,19 @@ func (c context) mangle(templateName string) string {
return templateName
}
s := templateName + "$htmltemplate_" + c.state.String()
if c.delim != 0 {
if c.delim != delimNone {
s += "_" + c.delim.String()
}
if c.urlPart != 0 {
if c.urlPart != urlPartNone {
s += "_" + c.urlPart.String()
}
if c.jsCtx != 0 {
if c.jsCtx != jsCtxRegexp {
s += "_" + c.jsCtx.String()
}
if c.attr != 0 {
if c.attr != attrNone {
s += "_" + c.attr.String()
}
if c.element != 0 {
if c.element != elementNone {
s += "_" + c.element.String()
}
return s