diff options
author | Vincent Ambo <tazjin@google.com> | 2019-08-23T10·24+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-08-23T10·24+0100 |
commit | 4f8885197196b58b0878aedd8a6108f66d0959f8 (patch) | |
tree | 9e48d62254704ad8d2e35ade41b7218e13b2bbef /tools/blog_cli/main.go | |
parent | 57059fec2b326af40394d3076aee941471083f88 (diff) |
fix(blog_cli): Quote JSON output for post dates r/53
Diffstat (limited to 'tools/blog_cli/main.go')
-rw-r--r-- | tools/blog_cli/main.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/blog_cli/main.go b/tools/blog_cli/main.go index 2dd879366316..db64f8378e40 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) } |