Repository: bombsimon/wsl (go)

Issue:
Multilin case statements should be allowed
It's not possible to break cases into multiple lines but it really should!

```go
switch {
case true, // Does work for *first* statement.
	false:
	fmt.Println("x")
case true, // Doesn't work here
	false:
	fmt.Println("x")
case true || // Same with || operator
	false:
	fmt.Println("x")
case true, false: // Ok
	fmt.Println("x")
case true || false: // Ok
	fmt.Println("x")
}

```

Pull request description:
Check next block start by case, not colon
This resolves #29 

Patch:
diff --git a/wsl.go b/wsl.go
index ff5798d..eb98deb 100644
--- a/wsl.go
+++ b/wsl.go
@@ -815,9 +815,9 @@ func (p *Processor) findLeadingAndTrailingWhitespaces(stmt, nextStatement ast.No
 
 		switch n := nextStatement.(type) {
 		case *ast.CaseClause:
-			blockEndPos = n.Colon
+			blockEndPos = n.Case
 		case *ast.CommClause:
-			blockEndPos = n.Colon
+			blockEndPos = n.Case
 		default:
 			// We're not at the end of the case?
 			return


Test patch:
diff --git a/wsl_test.go b/wsl_test.go
index 557e849..ae8a5ab 100644
--- a/wsl_test.go
+++ b/wsl_test.go
@@ -1014,6 +1014,47 @@ func TestShouldAddEmptyLines(t *testing.T) {
 				"if statements should only be cuddled with assignments used in the if statement itself",
 			},
 		},
+		{
+			description: "multiline case statements",
+			code: []byte(`package main
+
+			func main() {
+				switch {
+				case true,
+					false:
+					fmt.Println("ok")
+				case true ||
+					false:
+					fmt.Println("ok")
+				case true, false:
+					fmt.Println("ok")
+				case true || false:
+					fmt.Println("ok")
+				case true,
+					false:
+
+					fmt.Println("starting whitespace multiline case")
+				case true ||
+					false:
+
+					fmt.Println("starting whitespace multiline case")
+				case true,
+					false:
+					fmt.Println("ending whitespace multiline case")
+
+				case true,
+					false:
+					fmt.Println("last case should also fail")
+
+				}
+			}`),
+			expectedErrorStrings: []string{
+				"block should not end with a whitespace (or comment)",
+				"block should not start with a whitespace",
+				"block should not start with a whitespace",
+				"block should not end with a whitespace (or comment)",
+			},
+		},
 	}
 
 	for _, tc := range cases {