Skip to content
New issue

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

io: io.ReadAll(nil) panics #64714

Closed
jim-minter opened this issue Dec 14, 2023 · 1 comment
Closed

io: io.ReadAll(nil) panics #64714

jim-minter opened this issue Dec 14, 2023 · 1 comment

Comments

@jim-minter
Copy link

Go version

go version go1.21.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/jimminter/.cache/go-build'
GOENV='/home/jimminter/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jimminter/go/pkg/mod'
GONOPROXY='go.goms.io,goms.io'
GONOSUMDB='go.goms.io,goms.io'
GOOS='linux'
GOPATH='/home/jimminter/go'
GOPRIVATE='go.goms.io,goms.io'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3119686973=/tmp/go-build -gno-record-gcc-switches'

What did you do?

io.ReadAll(nil) panics. Please consider whether alternative behavior would be better?

https://go.dev/play/p/TQg_nv6icS0

What did you expect to see?

I'm not sure whether there's a better behavior than a panic, for example returning nil, nil, or nil, <some error>. I don't know what the standard library policy is around this sort of thing. It maybe that this is sufficiently unimportant and core that it's best not to change the behavior. Please consider?

What did you see instead?

io.ReadAll(nil) panics.

@seankhliao
Copy link
Member

it's correct for it to panic on an invalid argument

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants