mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 13:40:38 +03:00
all: Handle all errors
As reported by `errcheck`.
This commit is contained in:
parent
e77bb13c20
commit
c4a1165587
7 changed files with 55 additions and 29 deletions
|
@ -27,7 +27,9 @@ var hugoGeneratorTag = fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`
|
|||
// HugoGeneratorInject injects a meta generator tag for Hugo if none present.
|
||||
func HugoGeneratorInject(ct contentTransformer) {
|
||||
if metaTagsCheck.Match(ct.Content()) {
|
||||
ct.Write(ct.Content())
|
||||
if _, err := ct.Write(ct.Content()); err != nil {
|
||||
helpers.DistinctWarnLog.Println("Failed to inject Hugo generator tag:", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -41,5 +43,8 @@ func HugoGeneratorInject(ct contentTransformer) {
|
|||
newcontent = bytes.Replace(ct.Content(), []byte(head), replace, 1)
|
||||
}
|
||||
|
||||
ct.Write(newcontent)
|
||||
if _, err := ct.Write(newcontent); err != nil {
|
||||
helpers.DistinctWarnLog.Println("Failed to inject Hugo generator tag:", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue