mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Simplify code
- Use bytes.Equal instead of bytes.Compare - Omit range's value where it's unused
This commit is contained in:
parent
bd98182dbd
commit
a93cbb0d6c
2 changed files with 4 additions and 4 deletions
|
@ -45,7 +45,7 @@ func TestTrimShortHTML(t *testing.T) {
|
|||
c := newTestContentSpec()
|
||||
for i, test := range tests {
|
||||
output := c.TrimShortHTML(test.input)
|
||||
if bytes.Compare(test.output, output) != 0 {
|
||||
if !bytes.Equal(test.output, output) {
|
||||
t.Errorf("Test %d failed. Expected %q got %q", i, test.output, output)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ func (t *htmlTemplates) addTemplateIn(tt *template.Template, name, tpl string) (
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for k, _ := range c.notFound {
|
||||
for k := range c.notFound {
|
||||
t.transformNotFound[k] = true
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ func (t *textTemplates) addTemplateIn(tt *texttemplate.Template, name, tpl strin
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for k, _ := range c.notFound {
|
||||
for k := range c.notFound {
|
||||
t.transformNotFound[k] = true
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ func (t *templateHandler) postTransform() error {
|
|||
return templT.Tree
|
||||
}, t.text.transformNotFound},
|
||||
} {
|
||||
for name, _ := range s.transformNotFound {
|
||||
for name := range s.transformNotFound {
|
||||
templ := s.lookup(name)
|
||||
if templ != nil {
|
||||
_, err := applyTemplateTransformers(templateUndefined, templ, s.lookup)
|
||||
|
|
Loading…
Reference in a new issue