mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 20:33:59 +02:00
all: Handle all errors
As reported by `errcheck`.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user