Skip to content

Commit c0ef32b

Browse files
committed
ST1021: handle type names that are also articles
Closes gh-1187 (cherry picked from commit 416f0a8)
1 parent 880a503 commit c0ef32b

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
@@ -876,6 +876,11 @@ func CheckExportedTypeDocs(pass *analysis.Pass) (interface{}, error) {
876876
}
877877
}
878878

879+
// Check comment before we strip articles in case the type's name is an article.
880+
if strings.HasPrefix(text, node.Name.Name+" ") {
881+
return false
882+
}
883+
879884
s := text
880885
articles := [...]string{"A", "An", "The"}
881886
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 // want `comment on exported type`
5656
// Whatever
5757
type T14 struct{}
58+
59+
// A does stuff.
60+
type A struct{}

0 commit comments

Comments
 (0)