Skip to content

Commit ecccb24

Browse files
hypnoglowjirfag
authored andcommitted
Fix autogen exclude for comments under package (#831)
1 parent 2346cd8 commit ecccb24

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

pkg/result/processors/autogenerated_exclude.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func getDoc(filePath string) (string, error) {
126126
if strings.HasPrefix(line, "//") { //nolint:gocritic
127127
text := strings.TrimSpace(strings.TrimPrefix(line, "//"))
128128
docLines = append(docLines, text)
129-
} else if line == "" {
129+
} else if line == "" || strings.HasPrefix(line, "package") {
130130
// go to next line
131131
} else {
132132
break

pkg/result/processors/autogenerated_exclude_test.go

+21-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/result/processors/testdata/autogen_exclude.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
// third line
55

66
package testdata // no this text
7-
// and no this text too
7+
// and this text also
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package testdata
2+
3+
// DO NOT EDIT
4+
5+
import "fmt"
6+
7+
// nolint
8+
func PrintString(s string) {
9+
fmt.Printf("%s", s)
10+
}

0 commit comments

Comments
 (0)