Skip to content
This repository was archived by the owner on May 9, 2021. It is now read-only.

Let Golint ignore a function whose name starts "Benchmark" when it checks function declarations. #44

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (f *file) lintNames() {
}
}
case *ast.FuncDecl:
if f.isTest() && (strings.HasPrefix(v.Name.Name, "Example") || strings.HasPrefix(v.Name.Name, "Test")) {
if f.isTest() && (strings.HasPrefix(v.Name.Name, "Example") || strings.HasPrefix(v.Name.Name, "Test") || strings.HasPrefix(v.Name.Name, "Benchmark")) {
return true
}
check(v.Name, "func")
Expand Down