Bools: return the matched []bool, not the nil intermediate#416
Merged
knadh merged 1 commit intoMay 28, 2026
Merged
Conversation
The []bool case in the type switch returned out, which is the locally
declared var out []bool that's only filled by the []any branch. So
Bools("key") on a value stored natively as []bool returned nil,
matching the docstring's empty-slice intent only by accident on the
unknown-type fall-through (which actually returns nil too).
Mirrors what Ints, Int64s, and Float64s already do for their native-type
cases.
Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
849f0a9 to
a064082
Compare
Maks1mS
pushed a commit
to stplr-dev/stplr
that referenced
this pull request
May 30, 2026
This PR contains the following updates: | Package | Type | Update | Change | OpenSSF | |---|---|---|---|---| | [github.com/knadh/koanf/v2](https://github.com/knadh/koanf) | require | patch | `v2.3.4` → `v2.3.5` | [](https://securityscorecards.dev/viewer/?uri=github.com/knadh/koanf) | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information. --- ### Release Notes <details> <summary>knadh/koanf (github.com/knadh/koanf/v2)</summary> ### [`v2.3.5`](https://github.com/knadh/koanf/releases/tag/v2.3.5) [Compare Source](knadh/koanf@v2.3.4...v2.3.5) #### What's Changed - go-toml v3.3.0 by [@​GreyXor](https://github.com/GreyXor) in [#​410](knadh/koanf#410) - Bump github.com/go-jose/go-jose/v4 from 4.1.0 to 4.1.4 in /providers/vault by [@​dependabot](https://github.com/dependabot)\[bot] in [#​411](knadh/koanf#411) - go-toml v2.3.1 by [@​GreyXor](https://github.com/GreyXor) in [#​414](knadh/koanf#414) - feat: Add k8smount provider by [@​mattdowdell](https://github.com/mattdowdell) in [#​409](knadh/koanf#409) - Bools: return the matched \[]bool, not the nil intermediate by [@​c-tonneslan](https://github.com/c-tonneslan) in [#​416](knadh/koanf#416) - fix: report the full key path in MergeStrict type-mismatch error by [@​koriyoshi2041](https://github.com/koriyoshi2041) in [#​418](knadh/koanf#418) #### New Contributors - [@​mattdowdell](https://github.com/mattdowdell) made their first contribution in [#​409](knadh/koanf#409) - [@​c-tonneslan](https://github.com/c-tonneslan) made their first contribution in [#​416](knadh/koanf#416) - [@​koriyoshi2041](https://github.com/koriyoshi2041) made their first contribution in [#​418](knadh/koanf#418) **Full Changelog**: <knadh/koanf@v2.3.4...v2.3.5> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`) - Only on Sunday and Saturday (`* * * * 0,6`) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xOTUuMyIsInVwZGF0ZWRJblZlciI6IjQzLjE5NS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY2llcyJdfQ==--> Reviewed-on: https://altlinux.space/stapler/stplr/pulls/445
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spotted while reading getters.go. The Bools() type switch has
but
outis thevar out []booldeclared above and only filled by the[]anybranch, so on a value stored natively as a[]bool(e.g. via the confmap provider) Bools() returns nil. Mirrors what Ints, Int64s, and Float64s already do for their native-type cases (they returnv).Added a tiny regression test in koanf_test.go using the confmap provider; it fails on master with
<nil>vs the expected[]bool{true, false, true}.