-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
refactor(fuzz): use mapsutil.Map
type
#5558
refactor(fuzz): use mapsutil.Map
type
#5558
Conversation
Signed-off-by: Dwi Siswanto <[email protected]>
Signed-off-by: Dwi Siswanto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking as request changes to review a potential suggestion
pkg/fuzz/component/path.go
Outdated
original := originalValues[key].(string) | ||
new := q.value.parsed.Map[key].(string) | ||
|
||
original := originalValues.GetOrDefault(key, "").(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we guard here using fmt.Sprint(..)
, anyway if it's a string we will get the same value of .(string)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we guard here using
fmt.Sprint(..)
[...]
If the values are always strings (or not?), sticking with the type assertion might be preferable for performance & type safety reasons.
[...] anyway if it's a string we will get the same value of
.(string)
?
Since the type of map is any
, we still need to do a type assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we should ensure that the assertion went correctly with:
a, ok := c.(string)
if !ok {
continue
}
what do you think?
Signed-off-by: Dwi Siswanto <[email protected]>
Proposed changes
Fix #5557
Checklist