{"action":"created","issue":{"url":"https://api.github.com/repos/golang/protobuf/issues/12","labels_url":"https://api.github.com/repos/golang/protobuf/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/golang/protobuf/issues/12/comments","events_url":"https://api.github.com/repos/golang/protobuf/issues/12/events","html_url":"https://github.com/golang/protobuf/pull/12","id":59513327,"number":12,"title":"Fix generated import statements","user":{"login":"mattheath","id":181548,"avatar_url":"https://avatars.githubusercontent.com/u/181548?v=3","gravatar_id":"","url":"https://api.github.com/users/mattheath","html_url":"https://github.com/mattheath","followers_url":"https://api.github.com/users/mattheath/followers","following_url":"https://api.github.com/users/mattheath/following{/other_user}","gists_url":"https://api.github.com/users/mattheath/gists{/gist_id}","starred_url":"https://api.github.com/users/mattheath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattheath/subscriptions","organizations_url":"https://api.github.com/users/mattheath/orgs","repos_url":"https://api.github.com/users/mattheath/repos","events_url":"https://api.github.com/users/mattheath/events{/privacy}","received_events_url":"https://api.github.com/users/mattheath/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-02T17:28:41Z","updated_at":"2015-05-07T08:50:08Z","closed_at":"2015-04-29T05:45:30Z","pull_request":{"url":"https://api.github.com/repos/golang/protobuf/pulls/12","html_url":"https://github.com/golang/protobuf/pull/12","diff_url":"https://github.com/golang/protobuf/pull/12.diff","patch_url":"https://github.com/golang/protobuf/pull/12.patch"},"body":"(via @mattoddie)\r\n\r\nAs described in #8 and #10 the import statements written to the generated `.pb.go` files don't seem to work as expected, which results in import statements trying to import files ending in `.pb` rather than the package - eg. `import foo \"foo/foo.pb\"` rather than `import foo \"foo\"`.\r\n\r\nI'm uncertain if this is due to incorrect usage on my part, as our import statements are usually fully qualified import paths, such as:\r\n`import \"github.com/<org>/<repo>/proto/common/common.proto\";`\r\nwhich I would expect to generate an import statement of:\r\n`import common \"github.com/<org>/<repo>/proto/common\"`\r\n_not_:\r\n`import common \"github.com/<org>/<repo>/proto/common/common.pb\"`\r\n\r\nThis patch determines the directory that the proto file exists in, and uses that for the import, rather than stripping off `.go` from the filename. It also stops duplicate imports being given unique names, by incrementing each, so we can just import the package."},"comment":{"url":"https://api.github.com/repos/golang/protobuf/issues/comments/99777739","html_url":"https://github.com/golang/protobuf/pull/12#issuecomment-99777739","issue_url":"https://api.github.com/repos/golang/protobuf/issues/12","id":99777739,"user":{"login":"attilaolah","id":196617,"avatar_url":"https://avatars.githubusercontent.com/u/196617?v=3","gravatar_id":"","url":"https://api.github.com/users/attilaolah","html_url":"https://github.com/attilaolah","followers_url":"https://api.github.com/users/attilaolah/followers","following_url":"https://api.github.com/users/attilaolah/following{/other_user}","gists_url":"https://api.github.com/users/attilaolah/gists{/gist_id}","starred_url":"https://api.github.com/users/attilaolah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attilaolah/subscriptions","organizations_url":"https://api.github.com/users/attilaolah/orgs","repos_url":"https://api.github.com/users/attilaolah/repos","events_url":"https://api.github.com/users/attilaolah/events{/privacy}","received_events_url":"https://api.github.com/users/attilaolah/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T08:50:08Z","updated_at":"2015-05-07T08:50:08Z","body":"Thanks @dsymonds, would you be so kind to ping this PR once that \"something similar\" hits `master`?\r\n\r\n:bowtie: "}}