about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-08-23T10·24+0100
committerVincent Ambo <tazjin@google.com>2019-08-23T10·24+0100
commit4f8885197196b58b0878aedd8a6108f66d0959f8 (patch)
tree9e48d62254704ad8d2e35ade41b7218e13b2bbef /tools
parent57059fec2b326af40394d3076aee941471083f88 (diff)
fix(blog_cli): Quote JSON output for post dates r/53
Diffstat (limited to 'tools')
-rw-r--r--tools/blog_cli/main.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/blog_cli/main.go b/tools/blog_cli/main.go
index 2dd8793663..db64f8378e 100644
--- a/tools/blog_cli/main.go
+++ b/tools/blog_cli/main.go
@@ -36,7 +36,7 @@ var chunkSize = 200
 type day time.Time
 
 func (d day) MarshalJSON() ([]byte, error) {
-	j := (time.Time(d)).Format("2006-01-02")
+	j := (time.Time(d)).Format(`"2006-01-02"`)
 	return []byte(j), nil
 }
 
@@ -97,7 +97,11 @@ func (p *post) writeToDNS() error {
 
 // Encode given value as JSON and base64-encode it.
 func encodeJSON(v interface{}) string {
-	outer, _ := json.Marshal(v)
+	outer, err := json.Marshal(v)
+	if err != nil {
+		log.Fatalln("Failed to encode JSON", err)
+	}
+
 	return base64.RawStdEncoding.EncodeToString(outer)
 }