mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-23 22:23:36 +00:00
source, tpl: Fix staticcheck complaints
tpl/template_funcs.go:1019:3: the surrounding loop is unconditionally terminated source/lazy_file_reader.go:66:5: err != nil is always true for all possible values ([nil:error] != [nil:error])
This commit is contained in:
parent
bb36d57be5
commit
950034db5c
2 changed files with 3 additions and 4 deletions
|
@ -62,8 +62,7 @@ func (l *LazyFileReader) Read(p []byte) (n int, err error) {
|
||||||
}
|
}
|
||||||
l.contents = bytes.NewReader(b)
|
l.contents = bytes.NewReader(b)
|
||||||
}
|
}
|
||||||
l.contents.Seek(l.pos, 0)
|
if _, err = l.contents.Seek(l.pos, 0); err != nil {
|
||||||
if err != nil {
|
|
||||||
return 0, errors.New("failed to set read position: " + err.Error())
|
return 0, errors.New("failed to set read position: " + err.Error())
|
||||||
}
|
}
|
||||||
n, err = l.contents.Read(p)
|
n, err = l.contents.Read(p)
|
||||||
|
|
|
@ -1010,13 +1010,13 @@ func delimit(seq, delimiter interface{}, last ...interface{}) (template.HTML, er
|
||||||
}
|
}
|
||||||
|
|
||||||
var dLast *string
|
var dLast *string
|
||||||
for _, l := range last {
|
if len(last) > 0 {
|
||||||
|
l := last[0]
|
||||||
dStr, err := cast.ToStringE(l)
|
dStr, err := cast.ToStringE(l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dLast = nil
|
dLast = nil
|
||||||
}
|
}
|
||||||
dLast = &dStr
|
dLast = &dStr
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
seqv := reflect.ValueOf(seq)
|
seqv := reflect.ValueOf(seq)
|
||||||
|
|
Loading…
Reference in a new issue