Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.17 linux/amd64
Reproduced up to 1.14.12.
What did you do?
https://play.golang.org/p/XWirTpyJaDH
var (
a = &struct{}{}
b = &struct{}{}
)
fmt.Printf("%p %p %t\n", a, b, a == b)
Prints something like 0x555f30 0x555f30 true
. Replacing the Printf with
fmt.Printf("%p %t\n", a, a == b)
prints 0x555f30 false
.
Changing to a non-empty struct like struct { a int }
makes the issue go away.
What did you expect to see?
a != b
- The presence of the Printf should not influence the outcome of
a == b