On Sunday, September 15, 2019 at 1:26:06 AM UTC-4, Sathish VJ wrote:
>
> Yes, that makes sense. Thank you.
>
> The example I wrote was concocted. But I've seen others do it on their
> own types too, which didn't make sense at all. Maybe they were just
> copy-pasting similar code from elsewhere
Yes, that makes sense. Thank you.
The example I wrote was concocted. But I've seen others do it on their own
types too, which didn't make sense at all. Maybe they were just
copy-pasting similar code from elsewhere.
On Saturday, 14 September 2019 20:20:49 UTC+5:30, Ben Burwell wrote:
>
> On S
On Sat Sep 14, 2019 at 1:43 AM Sathish VJ wrote:
> I saw some code where there is a temporary type called *noMethod* created
> before performing custom marshaling.
>
> What is the purpose of doing this?
>
> type T struct {
> A int
> C string
> }
>
> func (t T) MarshalJSON() (text []byte, err
I saw some code where there is a temporary type called *noMethod* created
before performing custom marshaling.
What is the purpose of doing this?
type T struct {
A int
C string
}
func (t T) MarshalText() (text []byte, err error) {
type noMethod T
return json.Marshal(noMethod(t))
}
func