-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
spec: poorly documented slice definition syntax #30625
Comments
Ignore my deleted comment; I was looking at the struct section of composite literals. |
It doesn't seem "poorly documented" to me. The spec says, regarding keys in slice literals:
What's missing? |
At first i confused it with slicing operator but later noted that it is in |
What do you recommend that we change? |
May be describe it in "Slice expressions" or in "Composite literals" more clearly? I propose:
|
It seems to me that https://golang.org/ref/spec#Composite_literals already says that. As quoted above. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?But also on Windows and in Go 1.12
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/clO1qELMYH2
Also works nicely with arrays, and with multiple
:
:What did you expect to see?
This syntax should be well documented or invalid.
I found one example of this after "Examples of valid array, slice, and map literals:" in language specification. But it seems not enough.
What did you see instead?
This syntax is valid and seems poorly documented.
Thanks for directions to @irwinnoteam2009
The text was updated successfully, but these errors were encountered: