Thank you. Zero values are of course identical. I was only thinking about
the pointer case...
On Sunday, May 28, 2023 at 5:10:33 PM UTC+2 burak serdar wrote:
> Two values A and B are equal (A==B) if A and B have the same type and the
> same values. In a code where
>
> a:=clientContextKey{}
>
Two values A and B are equal (A==B) if A and B have the same type and the
same values. In a code where
a:=clientContextKey{}
b:=clientContextKey{}
a==b is true, because they have the same types, and they have the same
values (i.e. the empty value).
Note however:
a:={}
b:={}
It is not
I've recently stumbled across code like this
https://go.dev/play/p/u3UER2ywRlr:
type clientContextKey struct{}
ctx := context.Background()
ctx = context.WithValue(ctx, clientContextKey{}, "foo")
_, ok := ctx.Value(clientContextKey{}).(string)
Naively, I had expected this to fail since I