Skip to content

Commit

Permalink
fix exported #1002 for ast.Ident
Browse files Browse the repository at this point in the history
  • Loading branch information
comdiv committed Jun 28, 2024
1 parent 47f336c commit 98eabe8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rule/exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ func (w *lintExported) Visit(n ast.Node) ast.Visitor {

func (w *lintExported) doCheckPublicInterface(typeName string, iface *ast.InterfaceType) {
for _, m := range iface.Methods.List {
if _, ok := m.Type.(*ast.Ident); ok {
continue
}
if ast.IsExported(m.Names[0].Name) {
w.lintInterfaceMethod(typeName, m)
}
Expand Down
4 changes: 4 additions & 0 deletions testdata/exported-issue-1002.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ package golint

// Some - some interface
type Some interface {
Other // should not fail
// Correct - should do all correct
Correct()
// MATCH /comment on exported interface method Some.SemiCorrect should be of the form "SemiCorrect ..."/
SemiCorrect()
NonCorrect() // MATCH /public interface method Some.NonCorrect should be commented/
}

// Other - just to check names compatibility
type Other interface {}

// for private interfaces it doesn't check docs anyway

type somePrivate interface {
Expand Down

0 comments on commit 98eabe8

Please sign in to comment.