-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Description
Proposal Details
I know this is dangerously close to bike-shedding but I thought it worth the suggestion, even if it ends up being closed.
Here's a quite tortured example that's derived from something slightly less tortured.
package main
func main() {
xs := []int{0, 1, 2}
n := 1
ys := make([]int, 0, len(xs)-(n-1))
for range len(xs)-(n-1) {
ys = append(ys, len(xs)-(n-1))
}
}When passed through gofmt, this becomes
package main
func main() {
xs := []int{0, 1, 2}
n := 1
ys := make([]int, 0, len(xs)-(n-1))
for range len(xs) - (n - 1) {
ys = append(ys, len(xs)-(n-1))
}
}which, to my eye, seems worse. The terms after the range keyword form a tight conceptual cluster, but the text is spread.
I didn't see any discussion on #61405 about associated gofmt rules, so this may be an unintended outcome.
I propose that the spacing be as with function calls. I'm happy to have a stab at an implementation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Incoming