Skip to content

Fix autogen exclude for comments under package #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
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 pkg/result/processors/autogenerated_exclude.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func getDoc(filePath string) (string, error) {
if strings.HasPrefix(line, "//") { //nolint:gocritic
text := strings.TrimSpace(strings.TrimPrefix(line, "//"))
docLines = append(docLines, text)
} else if line == "" {
} else if line == "" || strings.HasPrefix(line, "package") {
// go to next line
} else {
break
Expand Down
26 changes: 21 additions & 5 deletions pkg/result/processors/autogenerated_exclude_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/result/processors/testdata/autogen_exclude.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
// third line

package testdata // no this text
// and no this text too
// and this text also
10 changes: 10 additions & 0 deletions pkg/result/processors/testdata/autogen_exclude_doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package testdata

// DO NOT EDIT

import "fmt"

// nolint
func PrintString(s string) {
fmt.Printf("%s", s)
}