We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
go version
go version go1.10.1 darwin/amd64
Yes.
Frequently declare 2D slices (slices of slices).
Whenever I do, it feels less straightforward than it should, which I feel goes against Go's commitment to simplicity.
sliceOfSlices := make([][]Type, x, y)
sliceOfSlices := make([][]Type, x) for i := range sliceOfSlices { sliceOfSlices[i] = make([]Type, y) }
The text was updated successfully, but these errors were encountered:
Note that the above is valid today, but has different semantics: https://play.golang.org/p/XUt9Lf0k8Cn
Sorry, something went wrong.
I've noticed that this is valid, but it seems to denote the cap: https://play.golang.org/p/NTu9P1zhS52
Perhaps instead it could be:
sliceOfSlices := make([][]Type, len(sliceOfSlices), len(sliceOfSlices[i]), cap(sliceOfSlices), cap(sliceOfSlices[i]))
It just seems more powerful and intuitive.
@AnvilDev - This was already proposed in #6282 and declined. You can go through that thread to understand the reasoning behind that decision.
Yes, this has been discussed before. It doesn't seem like this proposal adds anything new, so I'm going to close it as a duplicate.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What did you do?
Frequently declare 2D slices (slices of slices).
Whenever I do, it feels less straightforward than it should, which I feel goes against Go's commitment to simplicity.
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: