{"action":"opened","issue":{"url":"https://api.github.com/repos/gogo/protobuf/issues/75","labels_url":"https://api.github.com/repos/gogo/protobuf/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/gogo/protobuf/issues/75/comments","events_url":"https://api.github.com/repos/gogo/protobuf/issues/75/events","html_url":"https://github.com/gogo/protobuf/issues/75","id":90923936,"number":75,"title":"nil pointers in proto3","user":{"login":"olegdunkan","id":1710435,"avatar_url":"https://avatars.githubusercontent.com/u/1710435?v=3","gravatar_id":"","url":"https://api.github.com/users/olegdunkan","html_url":"https://github.com/olegdunkan","followers_url":"https://api.github.com/users/olegdunkan/followers","following_url":"https://api.github.com/users/olegdunkan/following{/other_user}","gists_url":"https://api.github.com/users/olegdunkan/gists{/gist_id}","starred_url":"https://api.github.com/users/olegdunkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olegdunkan/subscriptions","organizations_url":"https://api.github.com/users/olegdunkan/orgs","repos_url":"https://api.github.com/users/olegdunkan/repos","events_url":"https://api.github.com/users/olegdunkan/events{/privacy}","received_events_url":"https://api.github.com/users/olegdunkan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-25T10:32:51Z","updated_at":"2015-06-25T10:32:51Z","closed_at":null,"body":"Hello!\r\nLet we have this:\r\n\r\n```\r\nsyntax = \"proto3\";\r\npackage main;\r\nmessage Info {\r\n  \tstring group = 1;\r\n  \tstring key = 2;\r\n\tCard card = 3;\r\n}\r\nmessage Card {\r\n\tint32 number = 1;\r\n\tstring bank = 2;\r\n}\r\n```\r\nBut there is no check for nil pointers in generated .pg.go file.\r\n```\r\nfunc (m *Info) MarshalTo(data []byte) (n int, err error) {\r\n\tvar i int\r\n\t_ = i\r\n\tvar l int\r\n\t_ = l\r\n\tif len(m.Group) > 0 {\r\n\t\tdata[i] = 0xa\r\n\t\ti++\r\n\t\ti = encodeVarintScheme(data, i, uint64(len(m.Group)))\r\n\t\ti += copy(data[i:], m.Group)\r\n\t}\r\n\tif len(m.Key) > 0 {\r\n\t\tdata[i] = 0x12\r\n\t\ti++\r\n\t\ti = encodeVarintScheme(data, i, uint64(len(m.Key)))\r\n\t\ti += copy(data[i:], m.Key)\r\n\t}\r\n\tdata[i] = 0x4a\r\n\ti++\r\n\ti = encodeVarintScheme(data, i, uint64(m.CardBank.Size()))\r\n\tn1, err := m.CardBank.MarshalTo(data[i:])\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\ti += n1\r\n\treturn i, nil\r\n}\r\n```\r\nThat is why panic will occur in this code:\r\n```\r\ninfo := &Info{Group:\"A\", Key:\"1\"}\r\ninfo.Marshal()\r\n``` \r\nbut if I use golang/protobuf all is fine, what I am doing wrong? Or you doesn't support this behavior for nil pointers?\r\nI used last protoc and gofast.\r\nThank you.\r\n\r\n"}}