{"action":"closed","issue":{"url":"https://api.github.com/repos/gopherjs/gopherjs/issues/147","labels_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/147/comments","events_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/147/events","html_url":"https://github.com/gopherjs/gopherjs/issues/147","id":53377011,"number":147,"title":"Different results in Go / GopherJS when casting from one type to another","user":{"login":"flyth","id":1550037,"avatar_url":"https://avatars.githubusercontent.com/u/1550037?v=3","gravatar_id":"","url":"https://api.github.com/users/flyth","html_url":"https://github.com/flyth","followers_url":"https://api.github.com/users/flyth/followers","following_url":"https://api.github.com/users/flyth/following{/other_user}","gists_url":"https://api.github.com/users/flyth/gists{/gist_id}","starred_url":"https://api.github.com/users/flyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyth/subscriptions","organizations_url":"https://api.github.com/users/flyth/orgs","repos_url":"https://api.github.com/users/flyth/repos","events_url":"https://api.github.com/users/flyth/events{/privacy}","received_events_url":"https://api.github.com/users/flyth/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gopherjs/gopherjs/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-05T09:13:56Z","updated_at":"2015-01-07T01:15:40Z","closed_at":"2015-01-07T01:15:40Z","body":"When casting like below, GopherJS seems to create a new copy of the object for each cast instead of reusing the old one.\r\n\r\n```\r\npackage main\r\n\r\ntype Foo struct {\r\n\tValue int\r\n}\r\n\r\ntype Bar Foo\r\n\r\nfunc main() {\r\n\tx := &Foo{Value: 1}\r\n\ty := (*Bar)(x)\r\n\ty.Value = 2\r\n\tz := (*Foo)(y)\r\n\tz.Value = 3\r\n\tprint(x == z)\r\n\tprint(x.Value, y.Value, z.Value)\r\n}\r\n```\r\n\r\nI will take a closer look as well but maybe someone already knows how to implement a solution after reading this... :)\r\n\r\nThanks!"}}