Skip to content

Commit 610a2bd

Browse files
black-06ldez
andauthored
lll: skip go command (#3572)
Co-authored-by: Ludovic Fernandez <[email protected]>
1 parent b673c5c commit 610a2bd

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

pkg/golinters/lll.go

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919

2020
const lllName = "lll"
2121

22+
const goCommentDirectivePrefix = "//go:"
23+
2224
//nolint:dupl
2325
func NewLLL(settings *config.LllSettings) *goanalysis.Linter {
2426
var mu sync.Mutex
@@ -94,6 +96,10 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
9496
line := scanner.Text()
9597
line = strings.ReplaceAll(line, "\t", tabSpaces)
9698

99+
if strings.HasPrefix(line, goCommentDirectivePrefix) {
100+
continue
101+
}
102+
97103
if strings.HasPrefix(line, "import") {
98104
multiImportEnabled = strings.HasSuffix(line, "(")
99105
continue

test/testdata/lll.go

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
//golangcitest:config_path testdata/configs/lll.yml
33
package testdata
44

5+
import (
6+
_ "unsafe"
7+
)
8+
59
func Lll() {
610
// In my experience, long lines are the lines with comments, not the code. So this is a long comment // want "line is 137 characters"
711
}
12+
13+
//go:generate mockgen -source lll.go -destination a_verylong_generate_mock_my_lll_interface.go --package testdata -self_package github.com/golangci/golangci-lint/test/testdata
14+
type MyLllInterface interface {
15+
}
16+
17+
//go:linkname VeryLongNameForTestAndLinkNameFunction github.com/golangci/golangci-lint/test/testdata.VeryLongNameForTestAndLinkedNameFunction
18+
func VeryLongNameForTestAndLinkNameFunction()
19+
20+
func VeryLongNameForTestAndLinkedNameFunction() {}

0 commit comments

Comments
 (0)