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

len(l) > 0 && l[0] == nil panic #66930

Closed
hrz123 opened this issue Apr 19, 2024 · 1 comment
Closed

len(l) > 0 && l[0] == nil panic #66930

hrz123 opened this issue Apr 19, 2024 · 1 comment

Comments

@hrz123
Copy link

hrz123 commented Apr 19, 2024

Go version

go1.18

Output of go env in your module/workspace:

GO111MODULE="on"
GOARCH="arm64"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOOS="darwin"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/84/f6ytzpl10072g4x4pw8q98bc0000gn/T/go-build581550541=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

l is of type []interface{}
returned by following func

func (cmd *SliceCmd) Result() ([]interface{}, error) {
	return cmd.val, cmd.err
}

What did you see happen?

panic

What did you expect to see?

it shouldn't panic in my opinion. What's the root cause and how we can fix it.

@ianlancetaylor
Copy link
Contributor

We don't use the issue tracker for questions. Please ask on a forum instead. See https://go.dev/wiki/Questions. Thanks.

Also, it's impossible to answer your question with the information you've provided. When you ask on a forum, please show a complete self-contained example, and please show the panic output that you are getting.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
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