-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the Go vendor/ tree for automatic cross-project protobuf imports #30
Comments
There's one other thing to fix: for example:
Generates:
Which /would/ be valid if this was in the vendor/ tree, but it's not - so it would be necessary to replace the importPath for some paths with certain prefixes (that match the root project tree). In ts-poet/build/Import there is |
@stephenh Okay I've hacked up a fix for both of these issues:
Changes:
This creates a quite good way of working with Go projects:
Generates:
... and importing a path from the same project:
... generates a relative import:
The full example is here:
Currently using the hacky patch under patches/ So: to make this actually mergeable into ts-poet:
|
Fixed in #31 (afaiu :-)) |
@stephenh Not exactly - that only fixed half of the issue. |
@paralin which half? I know there is still the ts-proto side of this, if that is the half you're referring to, then agreed. Otherwise, for the ts-poet project/issue in particular, is there something specific in ts-poet that is still wrong/needs improved? |
@stephenh The hack I've put in place actually modifies some behavior in |
@paralin ah yeah, we're talking across ts-poet/ts-proto issues, but my assumption was that your further customization of My thought is that ts-proto is better setup to know "is this to-be-imported type 'in my current project' or 'from an external/vendored import'", and, then if so, also know "where is the external/vendored file actually at". Hence thinking that this ts-poet issue itself is good/closed, and the "other half" would be handling in the ts-proto issue 597, and/or improvements on top of it. |
@stephenh Agreed, just saying that some component of that logic will need to be added to ts-poet because the decision is per-import. |
From #597
Example: https://github.com/aperturerobotics/starpc
Issue: generates an incorrect import path:
Looking at the call stack:
Seems that it counts the number of slashes & generates
../../../..
prefix plus the import path (github.com...) when it might be better to do./
+ the relative path (./other) instead.The text was updated successfully, but these errors were encountered: