]> Cypherpunks.ru repositories - gostls13.git/commit
src/log/slog: disallow == on Values
authorJonathan Amsterdam <jba@google.com>
Mon, 27 Mar 2023 14:21:10 +0000 (10:21 -0400)
committerJonathan Amsterdam <jba@google.com>
Mon, 27 Mar 2023 17:28:00 +0000 (17:28 +0000)
commitd49b11be1d4413ac68d4a3127a506aa78bc7301a
treeb85dcd8ce96e25deb0d17e76ba453420a3342d58
parent936821050800f9067215b6dbe5f6072c5a0ee975
src/log/slog: disallow == on Values

Comparing two Values with == is sensitive to the internal
representation of Values, and may not correspond to
equality on the Go values they represent. For example,

    StringValue("X") != StringValue(strings.ToUpper("x"))

because Go ends up doing a pointer comparison on the data
stored in the Values.

So make Values non-comparable by adding a non-comparable field.

Updates #56345.

Change-Id: Ieedbf454e631cda10bc6fcf470b57d3f1d2182cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/479516
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/log/slog/attr.go
src/log/slog/record.go
src/log/slog/value.go