{"action":"created","issue":{"url":"https://api.github.com/repos/andyleap/gencode/issues/5","repository_url":"https://api.github.com/repos/andyleap/gencode","labels_url":"https://api.github.com/repos/andyleap/gencode/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/andyleap/gencode/issues/5/comments","events_url":"https://api.github.com/repos/andyleap/gencode/issues/5/events","html_url":"https://github.com/andyleap/gencode/issues/5","id":149233263,"number":5,"title":"Unsafe option generates faulty code","user":{"login":"alessandrousseglioviretta","id":2053914,"avatar_url":"https://avatars.githubusercontent.com/u/2053914?v=3","gravatar_id":"","url":"https://api.github.com/users/alessandrousseglioviretta","html_url":"https://github.com/alessandrousseglioviretta","followers_url":"https://api.github.com/users/alessandrousseglioviretta/followers","following_url":"https://api.github.com/users/alessandrousseglioviretta/following{/other_user}","gists_url":"https://api.github.com/users/alessandrousseglioviretta/gists{/gist_id}","starred_url":"https://api.github.com/users/alessandrousseglioviretta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alessandrousseglioviretta/subscriptions","organizations_url":"https://api.github.com/users/alessandrousseglioviretta/orgs","repos_url":"https://api.github.com/users/alessandrousseglioviretta/repos","events_url":"https://api.github.com/users/alessandrousseglioviretta/events{/privacy}","received_events_url":"https://api.github.com/users/alessandrousseglioviretta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-18T18:28:23Z","updated_at":"2016-04-18T19:30:49Z","closed_at":null,"body":"Please find attached the schema for a struct and the corresponding _.go_ files generated with the following commands: `gencode go -schema user.schema -package datatypes` and `gencode go -schema user.schema -package datatypes -unsafe`.\r\n\r\nThe Marshal method in the _unsafe_ file sets the three `int64` fields to zero (see lines 214-224):\r\n\r\n`\t{\r\n\r\n\t\td.LastSeen = *(*int64)(unsafe.Pointer(&buf[i+0]))\r\n\r\n\t}\r\n\t{\r\n\r\n\t\td.Created = *(*int64)(unsafe.Pointer(&buf[i+8]))\r\n\r\n\t}\r\n\t{\r\n\r\n\t\td.Updated = *(*int64)(unsafe.Pointer(&buf[i+16]))\r\n\r\n\t}\r\n\treturn buf[:i+24], nil\r\n`\r\n\r\nUsing `time` fields (still undocumented?) instead of `int64` works fine.\r\n\r\n[issue.zip](https://github.com/andyleap/gencode/files/224435/issue.zip)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/andyleap/gencode/issues/comments/211542113","html_url":"https://github.com/andyleap/gencode/issues/5#issuecomment-211542113","issue_url":"https://api.github.com/repos/andyleap/gencode/issues/5","id":211542113,"user":{"login":"andyleap","id":1445195,"avatar_url":"https://avatars.githubusercontent.com/u/1445195?v=3","gravatar_id":"","url":"https://api.github.com/users/andyleap","html_url":"https://github.com/andyleap","followers_url":"https://api.github.com/users/andyleap/followers","following_url":"https://api.github.com/users/andyleap/following{/other_user}","gists_url":"https://api.github.com/users/andyleap/gists{/gist_id}","starred_url":"https://api.github.com/users/andyleap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyleap/subscriptions","organizations_url":"https://api.github.com/users/andyleap/orgs","repos_url":"https://api.github.com/users/andyleap/repos","events_url":"https://api.github.com/users/andyleap/events{/privacy}","received_events_url":"https://api.github.com/users/andyleap/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T19:30:49Z","updated_at":"2016-04-18T19:30:49Z","body":"Yeah, I'll take care of that when I get home in a few hours"}}