Skip to content
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

Update internal HTTP methods to not take pointer to map as argument #269

Merged
merged 1 commit into from
Feb 20, 2021

Conversation

theckman
Copy link
Collaborator

Map types themselves are reference types, and can be passed in as nil even
without declaring the value as a pointer to the map.

Likewise, for maps that are nil the range operator is safe and no-ops and so
we do not need a nil check before doing the range. If for some reason we wanted
a check, a length check would be more appropriate than a nil check but it's not
necessary.

Map types themselves are reference types, and can be passed in as `nil` even
without declaring the value as a pointer to the map.

Likewise, for maps that are nil the `range` operator is safe and no-ops and so
we do not need a nil check before doing the range. If for some reason we wanted
a check, a length check would be more appropriate than a nil check but it's not
necessary.
@theckman
Copy link
Collaborator Author

@stmcallister this is a no-op, so it may make sense to also get it merged before 1.4.0.

Copy link
Contributor

@stmcallister stmcallister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. This looks good. Thanks for the contribution! 🎉

Copy link
Contributor

@Sjeanpierre Sjeanpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@theckman theckman added this to the v1.4.0 milestone Feb 20, 2021
@theckman theckman merged commit 00180a8 into master Feb 20, 2021
@theckman theckman mentioned this pull request Feb 20, 2021
@theckman theckman deleted the maps_are_pointers branch April 23, 2021 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants