From 362f6fe4ecd0f96a9778a43f0d45b963ab14b6b5 Mon Sep 17 00:00:00 2001 From: Daved Date: Mon, 6 Apr 2015 20:47:20 -0700 Subject: [PATCH] Added MarshalJSON and UnmarshalJSON comments to template to prevent golint from complaining. --- template.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template.go b/template.go index f937a6f..8280536 100644 --- a/template.go +++ b/template.go @@ -42,6 +42,7 @@ func init() { } } +// MarshalJSON returns *r as the JSON encoding of r. func (r {{$typename}}) MarshalJSON() ([]byte, error) { if s, ok := interface{}(r).(fmt.Stringer); ok { return json.Marshal(s.String()) @@ -53,6 +54,7 @@ func (r {{$typename}}) MarshalJSON() ([]byte, error) { return json.Marshal(s) } +// UnmarshalJSON sets *r to a copy of data. func (r *{{$typename}}) UnmarshalJSON(data []byte) error { var s string if err := json.Unmarshal(data, &s); err != nil {