Skip to content

Commit 95b0757

Browse files
committed
Fix marking file with cgo as autogenerated
1 parent 894ba0d commit 95b0757

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/result/processors/autogenerated_exclude.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ func getDoc(f *ast.File, fset *token.FileSet, filePath string) string {
116116
pos := g.Pos()
117117
filePos := fset.Position(pos)
118118
text := g.Text()
119-
isAllowed := pos < importPos && filePos.Column == 1
119+
120+
// files using cgo have implicitly added comment "Created by cgo - DO NOT EDIT"
121+
isAllowed := pos < importPos && filePos.Column == 1 && !strings.Contains(text, "Created by cgo")
120122
if isAllowed {
121123
autogenDebugf("file %q: pos=%d, filePos=%s: comment %q: it's allowed", filePath, pos, filePos, text)
122124
neededComments = append(neededComments, text)

0 commit comments

Comments
 (0)