{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/16023","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/16023/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/16023/comments","events_url":"https://api.github.com/repos/golang/go/issues/16023/events","html_url":"https://github.com/golang/go/issues/16023","id":159469785,"number":16023,"title":"reflect modyfied all strings (I can not modified single instance by reflect)","user":{"login":"SebastianPozoga","id":1093166,"avatar_url":"https://avatars.githubusercontent.com/u/1093166?v=3","gravatar_id":"","url":"https://api.github.com/users/SebastianPozoga","html_url":"https://github.com/SebastianPozoga","followers_url":"https://api.github.com/users/SebastianPozoga/followers","following_url":"https://api.github.com/users/SebastianPozoga/following{/other_user}","gists_url":"https://api.github.com/users/SebastianPozoga/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastianPozoga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastianPozoga/subscriptions","organizations_url":"https://api.github.com/users/SebastianPozoga/orgs","repos_url":"https://api.github.com/users/SebastianPozoga/repos","events_url":"https://api.github.com/users/SebastianPozoga/events{/privacy}","received_events_url":"https://api.github.com/users/SebastianPozoga/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-09T17:56:30Z","updated_at":"2016-06-09T18:17:05Z","closed_at":"2016-06-09T18:17:05Z","body":"1. What version of Go are you using (`go version`)?\r\ncurrent play.golang version\r\n \r\n2. What operating system and processor architecture are you using (`go env`)?\r\ncurrent play.golang version\r\n\r\n3. What did you do?\r\nI create script like that https://play.golang.org/p/u_tH8tTgs4\r\npackage main\r\n\r\n```\r\nimport (\r\n\t\"fmt\"\r\n\t\"reflect\"\r\n)\r\n\r\ntype T struct {\r\n\tp interface{}\r\n}\r\n\r\nfunc main() {\r\n\tstr := \"str\"\r\n\ttree := T{\r\n\t\tp: interface{}(&str),\r\n\t}\r\n\tv := reflect.ValueOf(tree.p).Elem()\r\n\tif !v.CanSet() {\r\n\t\tpanic(\"the value can not be set\")\r\n\t}\r\n\tv.SetString(\"new str\")\r\n\r\n\tfmt.Println(\"Hello, \", *(tree.p.(*string)), \" \", str)\r\n}\r\n```\r\n\r\nOutput:\r\n\r\n> Hello,  new str   new str\r\n\r\nIt mean str variable is changed. I am not sure it is correct action.  CanSet return false for *string always. When I use reflect I modified  both value.\r\n\r\n4. What did you expect to see?\r\n\r\n> Hello,  new str  str\r\n\r\n5. What did you see instead?\r\n\r\n> Hello,  new str   new str\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/224981482","html_url":"https://github.com/golang/go/issues/16023#issuecomment-224981482","issue_url":"https://api.github.com/repos/golang/go/issues/16023","id":224981482,"user":{"login":"ianlancetaylor","id":3194333,"avatar_url":"https://avatars.githubusercontent.com/u/3194333?v=3","gravatar_id":"","url":"https://api.github.com/users/ianlancetaylor","html_url":"https://github.com/ianlancetaylor","followers_url":"https://api.github.com/users/ianlancetaylor/followers","following_url":"https://api.github.com/users/ianlancetaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianlancetaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianlancetaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianlancetaylor/subscriptions","organizations_url":"https://api.github.com/users/ianlancetaylor/orgs","repos_url":"https://api.github.com/users/ianlancetaylor/repos","events_url":"https://api.github.com/users/ianlancetaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianlancetaylor/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T18:17:05Z","updated_at":"2016-06-09T18:17:05Z","body":"In effect, you did `p := &str` and then you did `*p = \"new str\"`.  This is working as expected."}}
{"actor":{"display_login":"ianlancetaylor"}}