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 lllName = "lll"
|
||||||
|
|
||||||
|
const goCommentDirectivePrefix = "//go:"
|
||||||
|
|
||||||
//nolint:dupl
|
//nolint:dupl
|
||||||
func NewLLL(settings *config.LllSettings) *goanalysis.Linter {
|
func NewLLL(settings *config.LllSettings) *goanalysis.Linter {
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
@ -94,6 +96,10 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
|
|||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
line = strings.ReplaceAll(line, "\t", tabSpaces)
|
line = strings.ReplaceAll(line, "\t", tabSpaces)
|
||||||
|
|
||||||
|
if strings.HasPrefix(line, goCommentDirectivePrefix) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(line, "import") {
|
if strings.HasPrefix(line, "import") {
|
||||||
multiImportEnabled = strings.HasSuffix(line, "(")
|
multiImportEnabled = strings.HasSuffix(line, "(")
|
||||||
continue
|
continue
|
||||||
|
13
test/testdata/lll.go
vendored
13
test/testdata/lll.go
vendored
@ -2,6 +2,19 @@
|
|||||||
//golangcitest:config_path testdata/configs/lll.yml
|
//golangcitest:config_path testdata/configs/lll.yml
|
||||||
package testdata
|
package testdata
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
func Lll() {
|
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"
|
// 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