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

internal/reflectlite: ValueError assumes that all errors pertain to Invalid Kind #39286

Closed
orirawlings opened this issue May 27, 2020 · 3 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@orirawlings
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go version go1.14.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/orawlings/Library/Caches/go-build"
GOENV="/Users/orawlings/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/orawlings/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5t/cdj9bckj1dn4jcmv_f8ndz0m0000gn/T/go-build938321065=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version go1.14.3 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.14.3
uname -v: Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.15.4
BuildVersion:	19E287
lldb --version: lldb-1103.0.22.10
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)

What did you do?

Consider the following programming error:

package main

import (
	"sort"
)

func main() {
	sort.Slice("a", func (i, j int) bool {
		return false
	})
}

What did you expect to see?

In earlier versions of go (when sort was still using reflect) we'd get a more accurate/helpful panic message:

$ go1.12.17 run main.go 
panic: reflect: call of Swapper on string Value
...

What did you see instead?

Since migration to internal/reflectlite we get the following instead:

$ go run main.go
panic: reflect: call of Swapper on zero Value
...
@orirawlings
Copy link
Contributor Author

I'd be amenable to contributing a fix for this one.

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label May 27, 2020
@ianlancetaylor ianlancetaylor added this to the Backlog milestone May 27, 2020
@ianlancetaylor
Copy link
Contributor

Go for it. Thanks. This won't go into the tree until the 1.16 release.

@gopherbot
Copy link

Change https://golang.org/cl/235522 mentions this issue: internal/reflectlite: include Kind in ValueError message

@dmitshur dmitshur modified the milestones: Backlog, Go1.16 Oct 7, 2020
@golang golang locked and limited conversation to collaborators Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants