-
Notifications
You must be signed in to change notification settings - Fork 55
feat: essential field for packages #127
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
Conversation
Syntactic sugar for adding essentials to all slices defined in the package without having to go one by one.
rebornplusplus
left a comment
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.
Cute PR. Looks good to me, thanks.
|
Nice.Thanks. This should be followed by https://warthogs.atlassian.net/browse/ROCKS-1038 |
niemeyer
left a comment
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.
Thanks, Alberto. A few comments:
internal/setup/setup_test.go
Outdated
| Package: "mypkg", | ||
| Name: "essential", | ||
| Essential: []setup.SliceKey{ | ||
| {"mypkg", "essential"}, |
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 one is awkward. We probably don't want self-references like this? This should probably be an error if explicit, and if implicit via the package-level essentials, we should drop it from this particular slice.
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.
Changed, it is now an error if a user adds the slice to the slice-level essentials. For package-level essentials, we just dont add the slice to itself.
niemeyer
left a comment
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.
Thanks, Alberto. Probably the final pass.
internal/setup/setup.go
Outdated
| Package string | ||
| Name string | ||
| Essential []SliceKey | ||
| Essential map[SliceKey]bool |
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 has changed since the last review, and it doesn't look natural. The de-duplication is a simple local need inside the particular algorithm that is parsing the slices. It doesn't justify changing how the whole code sees the list of essentials.
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.
I have changed it back. Instead of creating a map I am iterating over the list of essentials now. I assume the list will not be long enough to justify hashmap vs iteration over a slice, and the map requires extra allocations.
niemeyer
left a comment
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.
Looks good. Just a couple of trivials.
Syntactic sugar for adding essentials to all slices defined in the package without having to go one by one.