We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go1.22.1 darwin/arm64
go env
GO111MODULE='on' GOARCH='arm64' GOBIN='' GOCACHE='/Users/zhangxiaoxu/Library/Caches/go-build' GOENV='/Users/zhangxiaoxu/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/zhangxiaoxu/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/zhangxiaoxu/go' GOPRIVATE='' GOPROXY='https://goproxy.io,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.22.1' GCCGO='gccgo' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/85/455rptmx1d1g7s_qhnhnc9x00000gn/T/go-build3269171821=/tmp/go-build -gno-record-gcc-switches -fno-common'
type tt struct { } func TestNIL(t *testing.T) { var a any var er *tt = nil a = er if a == nil { fmt.Println("expected") } else { t.Errorf("didn't expected: %+v", a) } }
xiaoke_test.go:38: didn't expected: <nil>
--- FAIL: TestNIL (0.00s) FAIL
output:expected
The text was updated successfully, but these errors were encountered:
This is correct result. Resaon see https://go.dev/doc/faq#nil_error
Sorry, something went wrong.
It's right. a real type is * * tt .
a
* * tt
No branches or pull requests
Go version
go1.22.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
--- FAIL: TestNIL (0.00s)
FAIL
What did you expect to see?
output:expected
The text was updated successfully, but these errors were encountered: