lll: skip go command (#3572)
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
This commit is contained in:
parent
b673c5c1af
commit
610a2bd199
@ -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
|
||||
|
13
test/testdata/lll.go
vendored
13
test/testdata/lll.go
vendored
@ -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() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user