Skip to content

Commit

Permalink
Fix detect protoc generated file + add test this case
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostiam committed Oct 14, 2023
1 parent 2b140db commit af772e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion protogetter.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (r *Report) ToIssue(fset *token.FileSet) Issue {
}

func isProtocGeneratedFile(f *ast.File) bool {
return len(f.Comments) > 0 && strings.HasPrefix(f.Comments[0].Text(), "// Code generated by protoc-gen-go")
return len(f.Comments) > 0 && strings.HasPrefix(f.Comments[0].Text(), "Code generated by protoc-gen-go")
}

func formatNode(node ast.Node) string {
Expand Down
2 changes: 2 additions & 0 deletions protogetter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ import (
func Test(t *testing.T) {
testdata := analysistest.TestData()
analysistest.RunWithSuggestedFixes(t, testdata, protogetter.NewAnalyzer())

analysistest.Run(t, testdata, protogetter.NewAnalyzer(), "./proto/...")
}

0 comments on commit af772e8

Please sign in to comment.