Skip to content

Commit 416f0a8

Browse files
committed
ST1021: handle type names that are also articles
Closes gh-1187
1 parent 971b654 commit 416f0a8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

stylecheck/lint.go

+5
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,11 @@ func CheckExportedTypeDocs(pass *analysis.Pass) (interface{}, error) {
875875
}
876876
}
877877

878+
// Check comment before we strip articles in case the type's name is an article.
879+
if strings.HasPrefix(text, node.Name.Name+" ") {
880+
return false
881+
}
882+
878883
s := text
879884
articles := [...]string{"A", "An", "The"}
880885
for _, a := range articles {

stylecheck/testdata/src/CheckExportedTypeDocs/CheckExportedTypeDocs.go

+3
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ type T13 struct{}
5555
//some:directive //@ diag(`comment on exported type`)
5656
// Whatever
5757
type T14 struct{}
58+
59+
// A does stuff.
60+
type A struct{}

0 commit comments

Comments
 (0)