Skip to content

Commit 6b39b9e

Browse files
committed
document the removal of empty lines surrounding field lists
Our documentation of the rule was actually incorrect. We always applied it to all field lists, not interfaces. And we didn't take comments into account yet, which is what the recent change improved upon. While here, remove unintentional whitespace from the added tests.
1 parent 9827b59 commit 6b39b9e

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ var _ = map[string]string{
385385

386386
</details>
387387

388-
Interfaces should not have leading or trailing empty lines
388+
Field lists should not have leading or trailing empty lines
389389

390390
<details><summary><i>example</i></summary>
391391

@@ -396,6 +396,12 @@ type Person interface {
396396
397397
Age() int
398398
399+
}
400+
401+
type ZeroFields struct {
402+
403+
// No fields are needed here.
404+
399405
}
400406
```
401407

@@ -405,6 +411,10 @@ type Person interface {
405411
406412
Age() int
407413
}
414+
415+
type ZeroFields struct {
416+
// No fields are needed here.
417+
}
408418
```
409419

410420
</details>

testdata/scripts/block-empty.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ func f() {
2525

2626

2727
// lone comment
28-
29-
28+
29+
3030
}
3131

3232
type I interface {
3333

3434

3535
// lone comment
36-
37-
36+
37+
3838
}
3939

4040

@@ -43,19 +43,16 @@ func f() {
4343
type SOut struct {
4444

4545
// lone comment
46-
46+
4747
}
4848

4949
type IOut interface {
5050

51-
51+
5252
// lone comment
5353

5454

5555
}
56-
57-
58-
5956
-- foo.go.golden --
6057
package p
6158

0 commit comments

Comments
 (0)