Skip to content
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

proposal: runtime: mapaccess shouldn’t panic on nil map #29631

Closed
gbbr opened this issue Jan 9, 2019 · 2 comments
Closed

proposal: runtime: mapaccess shouldn’t panic on nil map #29631

gbbr opened this issue Jan 9, 2019 · 2 comments

Comments

@gbbr
Copy link
Member

gbbr commented Jan 9, 2019

I have a feeling this might have been discussed before, but I couldn’t find an issue. If it exists, please close this one.

Is there any benefit in having mapaccess panic on nil maps?
https://github.com/golang/go/blob/master/src/runtime/map.go#L57

Is there any down side to having a map automatically “made” (makemap) when it is nil? This would mirror the behaviour of slices too: appending to a nil slice creates it.

@gopherbot gopherbot added this to the Proposal milestone Jan 9, 2019
@bcmills
Copy link
Contributor

bcmills commented Jan 9, 2019

See #28133 (comment).

@bcmills bcmills closed this as completed Jan 9, 2019
@gbbr
Copy link
Member Author

gbbr commented Jan 9, 2019

Thanks! 🙇‍♂️

@golang golang locked and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants