From 95b0757a3f3198e14145e21ecfc19761739364b5 Mon Sep 17 00:00:00 2001 From: Denis Isaev Date: Sun, 1 Jul 2018 21:13:34 +0300 Subject: [PATCH] Fix marking file with cgo as autogenerated --- pkg/result/processors/autogenerated_exclude.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/result/processors/autogenerated_exclude.go b/pkg/result/processors/autogenerated_exclude.go index 6fbbc102..b49c5e70 100644 --- a/pkg/result/processors/autogenerated_exclude.go +++ b/pkg/result/processors/autogenerated_exclude.go @@ -116,7 +116,9 @@ func getDoc(f *ast.File, fset *token.FileSet, filePath string) string { pos := g.Pos() filePos := fset.Position(pos) text := g.Text() - isAllowed := pos < importPos && filePos.Column == 1 + + // files using cgo have implicitly added comment "Created by cgo - DO NOT EDIT" + isAllowed := pos < importPos && filePos.Column == 1 && !strings.Contains(text, "Created by cgo") if isAllowed { autogenDebugf("file %q: pos=%d, filePos=%s: comment %q: it's allowed", filePath, pos, filePos, text) neededComments = append(neededComments, text)