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

cleanup: remove BoolTrue and BoolFalse variable #68

Merged
merged 2 commits into from
Nov 4, 2022

Conversation

Abirdcfly
Copy link
Contributor

No description provided.

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
}

return false
return s.IsPrecreate != nil && *s.IsPrecreate
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is great - much clearer. Thanks for letting us know about the pointer package!

This line is much cleaner than the old function. No need to update the PR, but I wonder if using the BoolDeref() here would make the intent even clearer. E.g.:

return pointer.BoolDeref(s.IsPrecreate, false)

It would be really good to establish a common pattern for comparisons with maybe-null boolean attributes, and carry this forward.

Copy link
Contributor

@jkneubuh jkneubuh left a comment

Choose a reason for hiding this comment

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

@Abirdcfly thanks for the nice clean-up. Very clear with the new code. 👍

@jkneubuh jkneubuh merged commit 1cc98ad into hyperledger-labs:main Nov 4, 2022
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.

2 participants