-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove inline typeconvert when logging some thrift typedefs (#464)
#366 added fast zap logging by generating extra `MarshalLog...` methods on generated types. For typedefs in thrift, other types that log them will cast to the underlying type in their `MarshalLog...` method, causing the generated code to need to import multiple go packages generated from both direct and indirect thrift dependencies. This should not be necessary, as typedefs of complex types (anything that cannot be mapped directly to a go stdlib type) get their own `MarshalLog...` methods, which cast to underlying type when necessary. This PR changes the logging for typedef'ed fields to: - cast to the underlying type inline when the underlying thrift type directly maps to a go type. - defer to the typedef's generated `MarshalLog...` method otherwise. This results in having more predictable importpaths (eg knowing that one thrift import will lead to one go import in generated code) makes implementing good bazel rules for thriftrw easier. See internal issue GO-362 for a more elaborate example of how the current behaviour complicates our Bazel setup. Co-authored-by: Abhinav Gupta <abg@uber.com>
- Loading branch information
Showing
10 changed files
with
238 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.