-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Improve sizegen to handle more types #17583
base: main
Are you sure you want to change the base?
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
var stmts []jen.Code | ||
if node.String() == "math/big.Int" { | ||
// This type is not accessible, but with the given | ||
// accessors we can compute a proper size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Custom handling here for big.Int
for which we can more accurately compute the size.
@@ -502,7 +613,6 @@ func (sizegen *sizegen) sizeStmtForType(fieldName *jen.Statement, field types.Ty | |||
|
|||
var defaultGenTypes = []string{ | |||
"vitess.io/vitess/go/pools/smartconnpool.Setting", | |||
"vitess.io/vitess/go/vt/schema.DDLStrategySetting", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type is not used in any cache at the moment, so we can remove it.
This improves sizegen to handle additional types and also have a custom handler for big.Int since the size is computable with the given accessors and decimals are used pretty often. Signed-off-by: Dirkjan Bussink <[email protected]>
61b4605
to
53cb2da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This improves sizegen to handle additional types and also have a custom handler for big.Int since the size is computable with the given accessors and decimals are used pretty often.
Related Issue(s)
This is follow up to #17556 which fixed #17555 to make it more robust for more types in the future. There's another path that now would panic on unknown types instead of silently ignoring them.
Checklist