diff --git a/pkg/golinters/lll.go b/pkg/golinters/lll.go index 551ff98a..2e0ebdee 100644 --- a/pkg/golinters/lll.go +++ b/pkg/golinters/lll.go @@ -19,6 +19,8 @@ import ( const lllName = "lll" +const goCommentDirectivePrefix = "//go:" + //nolint:dupl func NewLLL(settings *config.LllSettings) *goanalysis.Linter { var mu sync.Mutex @@ -94,6 +96,10 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r line := scanner.Text() line = strings.ReplaceAll(line, "\t", tabSpaces) + if strings.HasPrefix(line, goCommentDirectivePrefix) { + continue + } + if strings.HasPrefix(line, "import") { multiImportEnabled = strings.HasSuffix(line, "(") continue diff --git a/test/testdata/lll.go b/test/testdata/lll.go index 001da2e3..89a143ab 100644 --- a/test/testdata/lll.go +++ b/test/testdata/lll.go @@ -2,6 +2,19 @@ //golangcitest:config_path testdata/configs/lll.yml package testdata +import ( + _ "unsafe" +) + func Lll() { // In my experience, long lines are the lines with comments, not the code. So this is a long comment // want "line is 137 characters" } + +//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 +type MyLllInterface interface { +} + +//go:linkname VeryLongNameForTestAndLinkNameFunction github.com/golangci/golangci-lint/test/testdata.VeryLongNameForTestAndLinkedNameFunction +func VeryLongNameForTestAndLinkNameFunction() + +func VeryLongNameForTestAndLinkedNameFunction() {}