Skip to content

Commit

Permalink
Bugfix for PartialMap.Get: found=false (#3127)
Browse files Browse the repository at this point in the history
I came across this trying to use `PartialMap.Get` and noticed that in
the current implementation, the second return value is always `err ==
nil`, which is redundant, instead of indicating whether the key was
found.
  • Loading branch information
thomas11 authored Mar 6, 2024
1 parent 1586bd5 commit e3646ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion provider/pkg/resources/raw_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (m PartialMap[T]) MarshalJSON() ([]byte, error) {
func (m *PartialMap[T]) Get(key string) (T, bool, error) {
rawMessage, ok := m.partialMap[key]
if !ok {
return *new(T), true, nil
return *new(T), false, nil
}
var value T
if _, err := json.Parse([]byte(rawMessage), &value, json.ZeroCopy); err != nil {
Expand Down

0 comments on commit e3646ac

Please sign in to comment.