aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-04-06 17:39:20 +0200
committerBjørn Erik Pedersen <[email protected]>2017-04-06 20:35:26 +0200
commitc4a116558725ab885b7d303e0924cf2b35c9ba79 (patch)
treebb1a784ec632a9dc360422aade152102952638c6 /transform
parente77bb13c201770929be6b5caf413be48ecbe1d8f (diff)
downloadhugo-c4a116558725ab885b7d303e0924cf2b35c9ba79.tar.gz
hugo-c4a116558725ab885b7d303e0924cf2b35c9ba79.zip
all: Handle all errors
As reported by `errcheck`.
Diffstat (limited to 'transform')
-rw-r--r--transform/hugogeneratorinject.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/transform/hugogeneratorinject.go b/transform/hugogeneratorinject.go
index a73227de7..4c37a058d 100644
--- a/transform/hugogeneratorinject.go
+++ b/transform/hugogeneratorinject.go
@@ -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)
+ }
+
}