Corrected MarshalJSON and UnmarshalJSON function comments within

template per Francesc's guidance.
This commit is contained in:
Daved 2015-04-23 13:35:24 -07:00
parent c55a706513
commit f6a8246543

View File

@ -42,7 +42,7 @@ func init() {
} }
} }
// MarshalJSON is generated. // MarshalJSON is generated so {{$typename}} satisfies json.Marshaler.
func (r {{$typename}}) MarshalJSON() ([]byte, error) { func (r {{$typename}}) MarshalJSON() ([]byte, error) {
if s, ok := interface{}(r).(fmt.Stringer); ok { if s, ok := interface{}(r).(fmt.Stringer); ok {
return json.Marshal(s.String()) return json.Marshal(s.String())
@ -54,7 +54,7 @@ func (r {{$typename}}) MarshalJSON() ([]byte, error) {
return json.Marshal(s) return json.Marshal(s)
} }
// UnmarshalJSON is generated. // UnmarshalJSON is generated so {{$typename}} satisfies json.Unmarshaler.
func (r *{{$typename}}) UnmarshalJSON(data []byte) error { func (r *{{$typename}}) UnmarshalJSON(data []byte) error {
var s string var s string
if err := json.Unmarshal(data, &s); err != nil { if err := json.Unmarshal(data, &s); err != nil {