Skip to content

reflect: slightly different error messages converting slice to array pointer #46743

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

Closed
gazerro opened this issue Jun 14, 2021 · 2 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@gazerro
Copy link
Contributor

gazerro commented Jun 14, 2021

With Go 1.17, the message of the runtime error that occurs when converting a slice to an array pointer differs slightly from the error returned by the Convert method of the reflect package

runtime error: cannot convert slice with length 1 to pointer to array with length 2

reflect: cannot convert slice with length 1 to array pointer with length 2

Usually the error messages returned by reflect are different from the runtime error messages, but in this case I don't know if it was supposed to be the same.

@mdempsky
Copy link
Contributor

I think the runtime error there is more correct: it's a "pointer to (array with length 2)", whereas the reflect wording suggests the pointer has a length, which is nonsensical as pointers do not have a length.

(That said, I was #TeamPointerToArray during the spec wording CL, but #TeamArrayPointer won out.)

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 14, 2021
@mdempsky mdempsky added this to the Go1.17 milestone Jun 14, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/327870 mentions this issue: reflect: use same conversion panic in reflect and runtime

@golang golang locked and limited conversation to collaborators Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants