Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.19.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/paul/Library/Caches/go-build" GOENV="/Users/paul/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/paul/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/paul/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.19.3/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.19.3/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.19.3" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/paul/Projects/mediaexchange-io/assert/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d3/gklpfnbs4dlcg4q03kw2dv7w0000gq/T/go-build1420062890=/tmp/go-build -gno-record-gcc-switches -fno-common" GOROOT/bin/go version: go version go1.19.3 darwin/amd64 GOROOT/bin/go tool compile -V: compile version go1.19.3 uname -v: Darwin Kernel Version 21.6.0: Thu Sep 29 20:12:57 PDT 2022; root:xnu-8020.240.7~1/RELEASE_X86_64 ProductName: macOS ProductVersion: 12.6.1 BuildVersion: 21G217 lldb --version: lldb-1400.0.38.13 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
What did you do?
https://go.dev/play/p/tVGd49zEvBc
What did you expect to see?
Output of both lines should be true
What did you see instead?
reflect.DeepEqual
returned false.
Details
According to the documentation for DeepEqual:
Other values - numbers, bools, strings, and channels - are deeply equal if they are equal using Go's == operator`
Apparently when comparing an ints of different widths, promotion isn't used by DeepEqual. Funny enough, this used to work. I think when the function was changed to func DeepEqual(x, y any) bool
from func DeepEqual(x, y interface{}) bool
this broke.