{"action":"created","issue":{"url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/47","repository_url":"https://api.github.com/repos/zombiezen/go-capnproto2","labels_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/47/comments","events_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/47/events","html_url":"https://github.com/zombiezen/go-capnproto2/issues/47","id":172372479,"number":47,"title":"Thinking: inference of import paths and package names","user":{"login":"zombiezen","id":181535,"avatar_url":"https://avatars1.githubusercontent.com/u/181535?v=3","gravatar_id":"","url":"https://api.github.com/users/zombiezen","html_url":"https://github.com/zombiezen","followers_url":"https://api.github.com/users/zombiezen/followers","following_url":"https://api.github.com/users/zombiezen/following{/other_user}","gists_url":"https://api.github.com/users/zombiezen/gists{/gist_id}","starred_url":"https://api.github.com/users/zombiezen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zombiezen/subscriptions","organizations_url":"https://api.github.com/users/zombiezen/orgs","repos_url":"https://api.github.com/users/zombiezen/repos","events_url":"https://api.github.com/users/zombiezen/events{/privacy}","received_events_url":"https://api.github.com/users/zombiezen/received_events","type":"User","site_admin":false},"labels":[{"id":262777893,"url":"https://api.github.com/repos/zombiezen/go-capnproto2/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":262777894,"url":"https://api.github.com/repos/zombiezen/go-capnproto2/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-22T05:32:13Z","updated_at":"2017-05-18T22:44:58Z","closed_at":null,"body":"I don't have a good solution for this yet, but it has been suggested to me that capnpc-go can/should be inferring the import path and package name for the generated code.  This can certainly be introduced in a backward-compatible way, since we currently require import paths and package names to be explicitly annotated, so this is just relaxing the rule.  Note that solving this would make #41 obsolete.\n\nExperience has shown me that finding the appropriate Go package boundaries is challenging.  Finding a good solution should address the following three use-cases:\n1. You have a bunch of schemas in one directory, but they're probably separate packages.  For example, the schemas included in capnproto (e.g. schema.capnp, persistent.capnp, rpc.capnp).  If foo.capnp is located at $root/foo.capnp, the generated Go file should be placed at $root/foo/foo.capnp.go.\n2. You have a bunch of schemas in one directory, but they're tightly coupled and should be one package.  If foo.capnp is located at $root/foo.capnp, the generated Go file should be placed at $root/foo.capnp.go.\n3. You are writing a Go project from scratch and so you place one schema per directory.  If foo.capnp is located at $root/foo.capnp, the generated Go file should be placed at $root/foo.capnp.go.  Note that this is a strict subset of the second use-case.\n"},"comment":{"url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/comments/302561808","html_url":"https://github.com/zombiezen/go-capnproto2/issues/47#issuecomment-302561808","issue_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/47","id":302561808,"user":{"login":"zombiezen","id":181535,"avatar_url":"https://avatars1.githubusercontent.com/u/181535?v=3","gravatar_id":"","url":"https://api.github.com/users/zombiezen","html_url":"https://github.com/zombiezen","followers_url":"https://api.github.com/users/zombiezen/followers","following_url":"https://api.github.com/users/zombiezen/following{/other_user}","gists_url":"https://api.github.com/users/zombiezen/gists{/gist_id}","starred_url":"https://api.github.com/users/zombiezen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zombiezen/subscriptions","organizations_url":"https://api.github.com/users/zombiezen/orgs","repos_url":"https://api.github.com/users/zombiezen/repos","events_url":"https://api.github.com/users/zombiezen/events{/privacy}","received_events_url":"https://api.github.com/users/zombiezen/received_events","type":"User","site_admin":false},"created_at":"2017-05-18T22:44:58Z","updated_at":"2017-05-18T22:44:58Z","body":"The problem with the command-line flag approach is that other files need to know the file's import path.  In seeing the complexity from Go's protoc interaction, I'm thinking that the explicit import path is a good idea.  Perhaps just making the output file path logic smarter would help here."}}
{"actor":{"display_login":"zombiezen"}}