Skip to content

Commit 0dbb927

Browse files
committed
tests: autofix whitespace
1 parent 6f36d37 commit 0dbb927

File tree

4 files changed

+88
-5
lines changed

4 files changed

+88
-5
lines changed

pkg/golinters/whitespace/testdata/fix/in/whitespace.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package p
55

66
import "fmt"
77

8-
//line yaccpar:1
98
func oneLeadingNewline() {
109

1110
fmt.Println("Hello world")

pkg/golinters/whitespace/testdata/fix/out/whitespace.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package p
55

66
import "fmt"
77

8-
//line yaccpar:1
98
func oneLeadingNewline() {
109
fmt.Println("Hello world")
1110
}
@@ -23,7 +22,6 @@ func oneNewlineFunc() {
2322

2423
func twoNewlinesFunc() {
2524

26-
2725
}
2826

2927
func noNewlineWithCommentFunc() {
@@ -63,13 +61,13 @@ func multiIfFunc() {
6361
if 1 == 1 &&
6462
2 == 2 {
6563

66-
fmt.Println("Hello nested multi-line world")
64+
fmt.Println("Hello nested multi-line world")
6765
}
6866
}
6967
}
7068
}
7169
}
7270

7371
func notGoFmted() {
74-
fmt.Println("Hello world")
72+
fmt.Println("Hello world")
7573
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
//golangcitest:args -Ewhitespace
2+
//golangcitest:config_path testdata/whitespace.yml
3+
package testdata
4+
5+
import "fmt"
6+
7+
func oneLeadingNewline() {
8+
9+
fmt.Println("Hello world")
10+
}
11+
12+
func oneNewlineAtBothEnds() {
13+
14+
fmt.Println("Hello world")
15+
16+
}
17+
18+
func noNewlineFunc() {
19+
}
20+
21+
func oneNewlineFunc() {
22+
23+
}
24+
25+
func twoNewlinesFunc() {
26+
27+
28+
}
29+
30+
func noNewlineWithCommentFunc() {
31+
// some comment
32+
}
33+
34+
func oneTrailingNewlineWithCommentFunc() {
35+
// some comment
36+
37+
}
38+
39+
func oneLeadingNewlineWithCommentFunc() {
40+
41+
// some comment
42+
}
43+
44+
func twoLeadingNewlines() {
45+
46+
47+
fmt.Println("Hello world")
48+
}
49+
50+
func multiFuncFunc(a int,
51+
b int) {
52+
fmt.Println("Hello world")
53+
}
54+
55+
func multiIfFunc() {
56+
if 1 == 1 &&
57+
2 == 2 {
58+
fmt.Println("Hello multi-line world")
59+
}
60+
61+
if true {
62+
if true {
63+
if true {
64+
if 1 == 1 &&
65+
2 == 2 {
66+
fmt.Println("Hello nested multi-line world")
67+
}
68+
}
69+
}
70+
}
71+
}
72+
73+
func notGoFmted() {
74+
75+
76+
77+
78+
fmt.Println("Hello world")
79+
80+
81+
82+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
linters-settings:
2+
whitespace:
3+
multi-if: true
4+
multi-func: true

0 commit comments

Comments
 (0)