Skip to content

spec: allow range-over-func to omit iteration variables #65236

Closed
@rsc

Description

@rsc

In discussion during the implementation of #61405 we changed range-over-func to require mentioning iteration variables. The idea is that if we do end up with idioms like:

for line, err := range FileLines("/etc/passwd") {
	...
}

Then we want to diagnose:

for line := range FileLines("/etc/passwd") {
	...
}

as an error. However, this is inconsistent with other range loops and also not what the #61405 text said. Probably we should change it. Starting a separate proposal for that discussion.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Status

Done

Status

Accepted

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions