Skip to content

doc: update README to document *bool behavior#51

Open
fchikwekwe wants to merge 1 commit intocreasty:masterfrom
fchikwekwe:master
Open

doc: update README to document *bool behavior#51
fchikwekwe wants to merge 1 commit intocreasty:masterfrom
fchikwekwe:master

Conversation

@fchikwekwe
Copy link
Copy Markdown

bool values that are unset (zero value is false) or have been set to false are indistinguishable from one another. As a result, bool values with default true that are set to false get overriden by the defaults library.

If the user declares a *bool in their struct, then there are three possible setting for boolean: true, false and unset.

Closes #49
Related to #50

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 22, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.97%. Comparing base (5220e08) to head (99f0f31).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #51   +/-   ##
=======================================
  Coverage   95.97%   95.97%           
=======================================
  Files           2        2           
  Lines         149      149           
=======================================
  Hits          143      143           
  Misses          3        3           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread README.md
- Scalar types
- `int/8/16/32/64`, `uint/8/16/32/64`, `float32/64`
- `uintptr`, `bool`, `string`
- `bool` values declared as a `*bool` allow for an unset boolean type. This helps distinguish the case where a default true bool is set to `false`.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is not exclusive to bool values.
Any scalar type can't distinguish an unspecified value from its zero value.
For int, an unspecified value means 0; For string, an empty string ("").

If we want to indicate this behavior in README, we might as well do with technicalities.

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.

Struct tag boolean values are not parsed properly when specified with double quotes

2 participants