Huh... I could have sworn that I tried it.
Thx!
On Tue, Nov 28, 2017, 5:59 PM roger peppe wrote:
> On 28 November 2017 at 16:30, Henrik Johansson
> wrote:
> > Ok, thanks for the clarification.
> >
> > Is there some way to reliably handle these
On 28 November 2017 at 16:30, Henrik Johansson wrote:
> Ok, thanks for the clarification.
>
> Is there some way to reliably handle these situations?
> I really like the idea of custom value types as keys.
As I did in my play.golang.org link, and others have pointed out too,
Ok, thanks for the clarification.
Is there some way to reliably handle these situations?
I really like the idea of custom value types as keys.
On Tue, Nov 28, 2017, 5:22 PM roger peppe wrote:
> > What tripped me up aside from reusing the map in the example was that in
>
The time example I have was just an example.
I have a trivial struct as key.
What tripped me up aside from reusing the map in the example was that in
case of errors a value type will still be put in the with it's default
value which my or may not for me. I avoided the whole thing by just using
* Henrik Johansson [171128 07:43]:
> But wouldn't unmarshal just overwrite in case of more trivial keys?
>
> So pointer receivers on the marshaling methods is better.
> I think I tried it but something else blew up.
While MarshalText can use a value or pointer receiver, it
But wouldn't unmarshal just overwrite in case of more trivial keys?
So pointer receivers on the marshaling methods is better.
I think I tried it but something else blew up.
tis 28 nov. 2017 kl 12:55 skrev roger peppe :
> You're seeing that behaviour because you're
James has it right. Try this: https://play.golang.org/p/VQPBwnh4Jn
On 27 November 2017 at 10:13, Henrik Johansson wrote:
> Hi,
>
> https://play.golang.org/p/bLiYSsKL_7
>
> I have perhaps missed something simple or misunderstood the contract for
> MarshalText/UnmarshalText
It seems that time.Time as keys exhibit the same issue:
https://play.golang.org/p/-_H3ZD6YLG
Is this really intended or a bug?
mån 27 nov. 2017 kl 11:25 skrev Henrik Johansson :
> There is a discussion here
>
There is a discussion here
https://groups.google.com/forum/#!searchin/golang-dev/json$20map/golang-dev/5gSHNrJQpUI/vZGSGRmUrC0J
and an issue here: https://github.com/golang/go/issues/12146
At least the issue has an initial example with a value type key
mån 27 nov. 2017 kl 11:21 skrev James
Think UnmarshalText needs to have a pointer receiver or you'll only be
modifying a copy of the struct
On 27 November 2017 at 23:13, Henrik Johansson wrote:
> Hi,
>
> https://play.golang.org/p/bLiYSsKL_7
>
> I have perhaps missed something simple or misunderstood the
Hi,
https://play.golang.org/p/bLiYSsKL_7
I have perhaps missed something simple or misunderstood the contract for
MarshalText/UnmarshalText but it seems to me that it should work it just
doesn't... :)
If I uncomment the return of the parse error "BOOM" then I just get a new
"default" key with 3
11 matches
Mail list logo