-
Notifications
You must be signed in to change notification settings - Fork 111
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
RSDK-9370: change param prefix check in module generation #4654
RSDK-9370: change param prefix check in module generation #4654
Conversation
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.
Abstractly this code all looks reasonable to me, but it's a lot of indexing math and string manipulation that I don't really have context for. It would be great if we could add a test somewhere to show that we're now correctly generating type names for maps, pointers, channels, etc., or at a minimum add a screenshot showing the corrected behavior (as opposed to the behavior in the screenshot on the ticket).
typeString := buf.String() | ||
|
||
prefixes := []string{"*", "[]*", "[]", "chan "} | ||
// checkUpper attributes to <resourceSubtype> if type is capitalized after prefix. |
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.
(minor) I think there's a word missing between "checkUpper" and "attributes"? Either that or i'm just having trouble parsing the grammar here.
Ticket found a bug where pointer param types weren't attributing to the resource subtype.
Return and param types were treated differently and separately, so even though return types were attributing pointer types correctly, params were not. Now, types are being formatted the same in both returns and types. Instead of a switch statement, a for loop that contains prefix types (
"*", "[]*", "[]", "chan "
) was introduced for scalability and readability.Testing:
formatType
arm
,board
, andcamera
components andvision service
. Not sure if there's other resources with more kinds of types that should be tested.arm component:
board component:
vision service: