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

Multiple slice dimensions from a single make() call. #24878

Closed
andres-valdes opened this issue Apr 16, 2018 · 1 comment
Closed

Multiple slice dimensions from a single make() call. #24878

andres-valdes opened this issue Apr 16, 2018 · 1 comment

Comments

@andres-valdes
Copy link

Why can't we declare the multiple dimensions of a multi-dimensional slice from a single make() call?

Isn't squareMatrix := make([][]int, n, n) far simpler than

squareMatrix := make([][]int, n)
for row := range squareMatrix {
    squareMatrix[row] = make([]int, n)
}

Is there some underlying reason as to why this isn't done?

@agnivade
Copy link
Contributor

Hi,

This appears to be a question rather than a Go bug. We do not use the issue tracker for general discussions or questions like these.

You might want to take a look at

For further questions, please have a look at Questions wiki page; it has a list of good places for asking questions.

Closing since this is not a bug.

@golang golang locked and limited conversation to collaborators Apr 16, 2019
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