Skip to content

reflect: slices created with MakeSlice are unaddressable values. #7355

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
gopherbot opened this issue Feb 19, 2014 · 1 comment
Closed

reflect: slices created with MakeSlice are unaddressable values. #7355

gopherbot opened this issue Feb 19, 2014 · 1 comment

Comments

@gopherbot
Copy link
Contributor

by jljatone:

What steps will reproduce the problem?
http://play.golang.org/p/a3-ieaWC6e

What is the expected output?
The Unmarshalled data in the provided slice.

What do you see instead?
panic: reflect.Value.Addr of unaddressable value

Which compiler are you using?
gccgo


Which operating system are you using?
arch linux

Which version are you using?  (run 'go version')
1.2


Please provide any additional information below.
playground link demonstrates the problem in its entirety.
@robpike
Copy link
Contributor

robpike commented Feb 24, 2014

Comment 1:

I assume you mean this (the version you linked works fine):
http://play.golang.org/p/B_agrsgc3h
The result of MakeSlice is a slice stored within an interface value under the hood. You
can't address it. The code is working as intended from the point of view of the rules of
engagement.
Make an addressable slice like this: http://play.golang.org/p/1S5zj4anuB
Or like this: http://play.golang.org/p/QY_TXUurYj

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants