File tree Expand file tree Collapse file tree 5 files changed +134
-0
lines changed
pkg/golinters/embeddedstructfieldcheck Expand file tree Collapse file tree 5 files changed +134
-0
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,11 @@ import (
9
9
func TestFromTestdata (t * testing.T ) {
10
10
integration .RunTestdata (t )
11
11
}
12
+
13
+ func TestFix (t * testing.T ) {
14
+ integration .RunFix (t )
15
+ }
16
+
17
+ func TestFixPathPrefix (t * testing.T ) {
18
+ integration .RunFixPathPrefix (t )
19
+ }
Original file line number Diff line number Diff line change
1
+ //golangcitest:args -Eembeddedstructfieldcheck
2
+ //golangcitest:expected_exitcode 0
3
+ package testdata
4
+
5
+ import "time"
6
+
7
+ type ValidStructWithSingleLineComments struct {
8
+ // time.Time Single line comment
9
+ time.Time
10
+
11
+ // version Single line comment
12
+ version int
13
+ }
14
+
15
+ type StructWithSingleLineComments struct {
16
+ // time.Time Single line comment
17
+ time.Time // want `there must be an empty line separating embedded fields from regular fields`
18
+
19
+ // version Single line comment
20
+ version int
21
+ }
22
+
23
+ type StructWithMultiLineComments struct {
24
+ // time.Time Single line comment
25
+ time.Time // want `there must be an empty line separating embedded fields from regular fields`
26
+
27
+ // version Single line comment
28
+ // very long comment
29
+ version int
30
+ }
31
+
32
+ type A struct {
33
+ // comment
34
+ ValidStructWithSingleLineComments
35
+ // C is foo
36
+ StructWithSingleLineComments // want `there must be an empty line separating embedded fields from regular fields`
37
+
38
+ D string
39
+ }
Original file line number Diff line number Diff line change
1
+ //golangcitest:args -Eembeddedstructfieldcheck
2
+ //golangcitest:expected_exitcode 0
3
+ package testdata
4
+
5
+ import (
6
+ "time"
7
+ )
8
+
9
+ type ValidStruct struct {
10
+ time.Time
11
+
12
+ version int
13
+ }
14
+
15
+ type NoSpaceStruct struct {
16
+ time.Time // want `there must be an empty line separating embedded fields from regular fields`
17
+ version int
18
+ }
19
+
20
+ type EmbeddedWithPointers struct {
21
+ * time.Time // want `there must be an empty line separating embedded fields from regular fields`
22
+ version int
23
+ }
Original file line number Diff line number Diff line change
1
+ //golangcitest:args -Eembeddedstructfieldcheck
2
+ //golangcitest:expected_exitcode 0
3
+ package testdata
4
+
5
+ import "time"
6
+
7
+ type ValidStructWithSingleLineComments struct {
8
+ // time.Time Single line comment
9
+ time.Time
10
+
11
+ // version Single line comment
12
+ version int
13
+ }
14
+
15
+ type StructWithSingleLineComments struct {
16
+ // time.Time Single line comment
17
+ time.Time // want `there must be an empty line separating embedded fields from regular fields`
18
+
19
+ // version Single line comment
20
+ version int
21
+ }
22
+
23
+ type StructWithMultiLineComments struct {
24
+ // time.Time Single line comment
25
+ time.Time // want `there must be an empty line separating embedded fields from regular fields`
26
+
27
+ // version Single line comment
28
+ // very long comment
29
+ version int
30
+ }
31
+
32
+ type A struct {
33
+ // comment
34
+ ValidStructWithSingleLineComments
35
+ // C is foo
36
+ StructWithSingleLineComments // want `there must be an empty line separating embedded fields from regular fields`
37
+
38
+ D string
39
+ }
Original file line number Diff line number Diff line change
1
+ //golangcitest:args -Eembeddedstructfieldcheck
2
+ //golangcitest:expected_exitcode 0
3
+ package testdata
4
+
5
+ import (
6
+ "time"
7
+ )
8
+
9
+ type ValidStruct struct {
10
+ time.Time
11
+
12
+ version int
13
+ }
14
+
15
+ type NoSpaceStruct struct {
16
+ time.Time // want `there must be an empty line separating embedded fields from regular fields`
17
+
18
+ version int
19
+ }
20
+
21
+ type EmbeddedWithPointers struct {
22
+ * time.Time // want `there must be an empty line separating embedded fields from regular fields`
23
+
24
+ version int
25
+ }
You can’t perform that action at this time.
0 commit comments