{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/6858","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/6858/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/6858/comments","events_url":"https://api.github.com/repos/golang/go/issues/6858/events","html_url":"https://github.com/golang/go/issues/6858","id":51285834,"number":6858,"title":"spec: field tags have to be identical when casting","user":{"login":"lukescott","id":486224,"avatar_url":"https://avatars.githubusercontent.com/u/486224?v=3","gravatar_id":"","url":"https://api.github.com/users/lukescott","html_url":"https://github.com/lukescott","followers_url":"https://api.github.com/users/lukescott/followers","following_url":"https://api.github.com/users/lukescott/following{/other_user}","gists_url":"https://api.github.com/users/lukescott/gists{/gist_id}","starred_url":"https://api.github.com/users/lukescott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukescott/subscriptions","organizations_url":"https://api.github.com/users/lukescott/orgs","repos_url":"https://api.github.com/users/lukescott/repos","events_url":"https://api.github.com/users/lukescott/events{/privacy}","received_events_url":"https://api.github.com/users/lukescott/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/LanguageChange","name":"LanguageChange","color":"ffaaaa"}],"state":"open","locked":false,"assignee":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/6","html_url":"https://github.com/golang/go/milestones/Unplanned","labels_url":"https://api.github.com/repos/golang/go/milestones/6/labels","id":1055141,"number":6,"title":"Unplanned","description":"No plan to fix in any specific release.\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":1326,"closed_issues":419,"state":"open","created_at":"2015-04-06T20:47:19Z","updated_at":"2016-06-13T15:24:04Z","due_on":"2099-12-31T05:00:00Z","closed_at":null},"comments":25,"created_at":"2013-12-01T17:19:37Z","updated_at":"2016-06-13T22:53:54Z","closed_at":null,"body":"<pre>Run this:\n\npackage main\n\ntype Message struct {\n\tId   int    `db:&quot;id&quot;`\n\tText string `db:&quot;text&quot;`\n}\n\ntype Message2 struct {\n\tId   int    `json:&quot;id&quot; xml:&quot;id,attr&quot;`\n\tText string `json:&quot;text&quot;`\n}\n\nfunc main() {\n\tmsg := Message{1, &quot;Hello&quot;}\n\tmsg2 := Message2(msg)\n\t_ = msg2\n}\n\nWhat is the expected output?\n\n[no output]\n\nWhat do you see instead?\n\ncannot convert msg (type Message) to type Message2\n\nWhich compiler are you using (5g, 6g, 8g, gccgo)?\n\nWhich version are you using?  (run 'go version')\n\ngo version devel +d744da8c8cbf Wed Sep 25 16:18:33 2013 -0400 darwin/amd64\n\nPlease provide any additional information below.\n\nI'm trying to decouple my database layer from my service layer into separate packages.\nTags in one package are only relevant to that package. What I'd like to do is re-define\nthe struct in my service layer and cast it from the database layer. The fields inside\nthe struct are otherwise exactly the same, besides the tags.\n\nUnfortunately it won't cast unless the tags are also exactly the same. The only solution\nI have at this point is put the structs in a &quot;common&quot; package that both the\ndatabase and service layers share. But then I'm mixing tags...</pre>"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/225732631","html_url":"https://github.com/golang/go/issues/6858#issuecomment-225732631","issue_url":"https://api.github.com/repos/golang/go/issues/6858","id":225732631,"user":{"login":"dionb","id":10458818,"avatar_url":"https://avatars.githubusercontent.com/u/10458818?v=3","gravatar_id":"","url":"https://api.github.com/users/dionb","html_url":"https://github.com/dionb","followers_url":"https://api.github.com/users/dionb/followers","following_url":"https://api.github.com/users/dionb/following{/other_user}","gists_url":"https://api.github.com/users/dionb/gists{/gist_id}","starred_url":"https://api.github.com/users/dionb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dionb/subscriptions","organizations_url":"https://api.github.com/users/dionb/orgs","repos_url":"https://api.github.com/users/dionb/repos","events_url":"https://api.github.com/users/dionb/events{/privacy}","received_events_url":"https://api.github.com/users/dionb/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T22:53:54Z","updated_at":"2016-06-13T22:53:54Z","body":"@mdempsky I understand exactly what Ian was talking about. This is an implementation detail in the sense that if you wanted to add another type (or 2+) that is of the underlying structure `{rtype, elem *rtype}` then you have to add a vestigial (for want of a better word) field with a unique name (and thus must know what all others have been created in this manor) to not potentially break the compiler, or your program.\r\n\r\nThis is not adding a defined behaviour to the language to create the functionality we want, it is relying on a side effect another feature of the language. This becomes more evident when you consider the case of defining types in normal programming that have the same underlying struct (which is different to the one above) but have different methods attached. To make sure they can't be converted between there is no documented feature of the language, you must use a side effect of a feature designed for storing data."}}
{"actor":{"display_login":"dionb"}}