-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
I really like the new semicolon rules, but a standard layout pattern for many people is to have 'else' on a new line. As in: if 1 == 2 { fmt.Println("line 1") } else { fmt.Println("line 2") } or: if 1 == 2 { fmt.Println("line 1") } else { fmt.Println("line 2") } However both these cause a "syntax error near else". What now is required is that the newline before the else is removed to give: } else { This is what gofmt does, but I do not understand the reasons for it based on the proposal given a few days ago for the new semicolon rules. I notice that the Channels example in "Go For C++ Programers" is in the now broken format: if c.get { c.val = val; ch <- c } else { val = c.val } Personally I prefer a newline before else rather than "} else {", but I prefer the new semicolon rules more. What is your $GOOS? $GOARCH? linux (Ubuntu 9.10) 386 (8g) Which revision are you using? (hg identify) e7f3b2a4d933 tip (I updated today)