Skip to content

Commit 1ad4d04

Browse files
tsuzuJoelSpeed
authored andcommitted
Add a test for inline fields
1 parent 8d9ba31 commit 1ad4d04

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/analysis/commentstart/testdata/src/a/a.go

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ type CommentStartTestStruct struct {
2020
NoComment string `json:"noComment"`
2121
} `json:"-"`
2222

23+
StructForInlineField `json:",inline"`
24+
2325
// IncorrectStartComment is a field with an incorrect start to the comment. // want "godoc for field IncorrectStartComment should start with 'incorrectStartComment ...'"
2426
IncorrectStartComment string `json:"incorrectStartComment"`
2527

@@ -47,6 +49,10 @@ type CommentStartTestStruct struct {
4749
// DoNothing is used to check that the analyser doesn't report on methods.
4850
func (CommentStartTestStruct) DoNothing() {}
4951

52+
type StructForInlineField struct {
53+
NoComment string `json:"noComment"` // want "field NoComment is missing godoc comment"
54+
}
55+
5056
type unexportedStruct struct {
5157
NoComment string `json:"noComment"` // want "field NoComment is missing godoc comment"
5258
}

pkg/analysis/commentstart/testdata/src/a/a.go.golden

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ type CommentStartTestStruct struct {
2020
NoComment string `json:"noComment"`
2121
} `json:"-"`
2222

23+
StructForInlineField `json:",inline"`
24+
2325
// incorrectStartComment is a field with an incorrect start to the comment. // want "godoc for field IncorrectStartComment should start with 'incorrectStartComment ...'"
2426
IncorrectStartComment string `json:"incorrectStartComment"`
2527

@@ -47,6 +49,10 @@ type CommentStartTestStruct struct {
4749
// DoNothing is used to check that the analyser doesn't report on methods.
4850
func (CommentStartTestStruct) DoNothing() {}
4951

52+
type StructForInlineField struct {
53+
NoComment string `json:"noComment"` // want "field NoComment is missing godoc comment"
54+
}
55+
5056
type unexportedStruct struct {
5157
NoComment string `json:"noComment"` // want "field NoComment is missing godoc comment"
5258
}

0 commit comments

Comments
 (0)