Skip to content

chore: improve map cast functions - #269

Merged
sagikazarmark merged 1 commit into
masterfrom
maps
Jun 1, 2025
Merged

chore: improve map cast functions#269
sagikazarmark merged 1 commit into
masterfrom
maps

Conversation

@sagikazarmark

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
@andig

andig commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

@sagikazarmark the downside with this change is that any function ignoring the the error (i.e. without E suffix) will now receive a nil instead of an empty map. That's unexpected compared to older versions and doesn't quite fit the slogan of

safe and easy casting from one type to another in Go

I couldn't determine from the code if you strictly require this change for anything? If not I would propose to always return the empty map instead of nil, as before, as a sane and safe default.

chouetz pushed a commit to DataDog/cast that referenced this pull request Apr 14, 2026
chore: improve map cast functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants