Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Import generated proto code from google.golang.org/genproto #312

Closed
jba opened this issue Jul 15, 2016 · 4 comments
Closed

Import generated proto code from google.golang.org/genproto #312

jba opened this issue Jul 15, 2016 · 4 comments
Assignees
Labels
lang: go Issues specific to Go. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@jba
Copy link
Contributor

jba commented Jul 15, 2016

Soon all generated proto files for Go will live at google.golang.org/genproto/... (which will map to the repo github.com/google/go-genproto). Generated code should use those import paths.

The import paths will not map directly to the proto package. The exactly relationship still hasn't been decided, but it's likely that code generated from googleapis/googleapis will have paths "googleapis/foo/bar", while well-known types and a few protos in google/apis will have different paths. Probably the best implementation will be a map of exceptions, and a fallback that does s/google/googleapis/.

Details forthcoming.

@okdave

@jba jba added the lang: go Issues specific to Go. label Jul 15, 2016
@saicheems
Copy link
Contributor

saicheems commented Jul 15, 2016

Any leeway on matching the proto package structure? It may be a late ask, but one issue with code generation is that proto paths are generated from either the proto package, or a specified go_package.

If the generated proto repo doesn't match the package hierarchy, we can still get around it for most protos by adding go_package vars to all the protos in googleapis/googleapis. Since the package protobuf isn't in our googleapis repo, I've always used a "hack" locally to ensure codegen got the right package path for imports.

If this has already been decided...
Michael: one possible solution, and maybe the least painful is to manually override the repo location of packages in the Go import handler.
It's not ideal... but theoretically you'd only have to force rename google.protobuf to github.com/google/go-genproto/foo/protobuf. For all the other protos, a possible solution is to add go_package to everything under googleapis/googleapis.

@jba
Copy link
Contributor Author

jba commented Jul 20, 2016

I think it's reasonable to add go_package wherever necessary. That would be done inside google3 for the files under /google/api. The well-known types already have a go_package.

@jba
Copy link
Contributor Author

jba commented Jul 21, 2016

The repo is ready. Browse at https://github.com/google/go-genproto, import from google.golang.org/genproto. Note that the ptypes package (containing well-known types like timestamp) was not moved.

As an initial task, you can regenerate the logging client. It uses monitored_resource, which is not in the same place as its proto package would suggest. Let me and @okdave know if you run into issues.

@pongad pongad mentioned this issue Jul 26, 2016
6 tasks
@pongad
Copy link
Contributor

pongad commented Jul 31, 2016

Fixed by #327.

@pongad pongad closed this as completed Jul 31, 2016
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang: go Issues specific to Go. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants