Skip to content

skip-dirs configuration field ot --skip-dirs not working #3775

Closed
@axetroy

Description

@axetroy

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc.).
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)

Description of the problem

I set skip-dirs in the configuration file.

But It still lint thie file in the dir.

See the configuration file below.

ent is a generated folder, so I set it to configuration file and --skip-dirs. none of one works

ref: #3711

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.52.2 built with go1.20.2 from da04413a on 2023-03-25T18:11:28Z

Configuration file

$ cat .golangci.yml
linters:
  timeout: 10m
  skip-dirs:
    - ent
  enable:
    - nilerr
  modules-download-mode: vendor

issues:
  fix: true

Go environment

$ go version && go env
go version go1.20 darwin/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/axetroy/Library/Caches/go-build"
GOENV="/Users/axetroy/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/axetroy/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/axetroy/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/yv/6d78vvyx3cs0yd1r6qqkk_0m0000gn/T/go-build1561328626=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/axetroy/go/src/github.com/axetroy/yhz-builder /Users/axetroy/go/src/github.com/axetroy /Users/axetroy/go/src/github.com /Users/axetroy/go/src /Users/axetroy/go /Users/axetroy /Users /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 8 linters: [errcheck gosimple govet ineffassign nilerr staticcheck typecheck unused] 
INFO [loader] Go packages loading at mode 575 (exports_file|imports|types_sizes|compiled_files|files|name|deps) took 3.633924872s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 44.030649ms 
ERRO [linters_context/goanalysis] buildssa: panic during analysis: in github.com/axetroy/yhz-builder/ent.withHooks$1: cannot convert *t0 (M) to PM, goroutine 14584 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x6b
panic({0x1b77900, 0xc03f0b4400})
        runtime/panic.go:884 +0x213
golang.org/x/tools/go/ssa.emitConv(0xc03a153680, {0x1f68560, 0xc03f0b1920}, {0x1f60378?, 0xc0368b3f20})
        golang.org/x/[email protected]/go/ssa/emit.go:286 +0xdbc
golang.org/x/tools/go/ssa.emitStore(0xc03a153680, {0x1f68560, 0xc03f0b1860}, {0x1f68560, 0xc03f0b1920}, 0xa098544)
        golang.org/x/[email protected]/go/ssa/emit.go:377 +0x5f
golang.org/x/tools/go/ssa.(*address).store(0xc03f0b6150, 0xc03a153680?, {0x1f68560?, 0xc03f0b1920?})
        golang.org/x/[email protected]/go/ssa/lvalue.go:40 +0x47
golang.org/x/tools/go/ssa.(*storebuf).emit(...)
        golang.org/x/[email protected]/go/ssa/builder.go:533
golang.org/x/tools/go/ssa.(*builder).assignStmt(0xc03a153680?, 0xc03a153680, {0xc02b447420, 0x1, 0x1cb1380?}, {0xc02b447430, 0x1, 0xc03a8c67b0?}, 0x0)
        golang.org/x/[email protected]/go/ssa/builder.go:1207 +0x43d
golang.org/x/tools/go/ssa.(*builder).stmt(0xc03a8c68e8?, 0xc03a153680, {0x1f62d90?, 0xc02b454680?})
        golang.org/x/[email protected]/go/ssa/builder.go:2181 +0x425
golang.org/x/tools/go/ssa.(*builder).stmtList(0x1?, 0xc03f0a1f20?, {0xc02b4546c0?, 0x4, 0xc0018efb00?})
        golang.org/x/[email protected]/go/ssa/builder.go:946 +0x45
golang.org/x/tools/go/ssa.(*builder).stmt(0xc03a153680?, 0xc03a153680, {0x1f62eb0?, 0xc02b452450?})
        golang.org/x/[email protected]/go/ssa/builder.go:2277 +0x859
golang.org/x/tools/go/ssa.(*builder).buildFunctionBody(0x0?, 0xc03a153680)
        golang.org/x/[email protected]/go/ssa/builder.go:2391 +0x437
golang.org/x/tools/go/ssa.(*builder).expr0(0xc03a8c7a38, 0xc03ae62f00, {0x1f63150?, 0xc02b447460?}, {0x7, {0x1f60288, 0xc036f30000}, {0x0, 0x0}})
        golang.org/x/[email protected]/go/ssa/builder.go:656 +0x4d6
golang.org/x/tools/go/ssa.(*builder).expr(0x1bbaf00?, 0xc03ae62f00, {0x1f63150, 0xc02b447460})
        golang.org/x/[email protected]/go/ssa/builder.go:625 +0x17b
golang.org/x/tools/go/ssa.(*builder).expr0(0xc03a8c7a38, 0xc03ae62f00, {0x1f62f10?, 0xc02b454740?}, {0x7, {0x1f60210, 0xc00e4d9180}, {0x0, 0x0}})
        golang.org/x/[email protected]/go/ssa/builder.go:676 +0x705
golang.org/x/tools/go/ssa.(*builder).expr(0xc03f0b1260?, 0xc03ae62f00, {0x1f62f10, 0xc02b454740})
        golang.org/x/[email protected]/go/ssa/builder.go:625 +0x17b
golang.org/x/tools/go/ssa.(*builder).assign(0xc03ae62f00?, 0xc03ae62f00?, {0x1f65520?, 0xc03f0a1e90}, {0x1f62f10?, 0xc02b454740?}, 0x8?, 0x0)
        golang.org/x/[email protected]/go/ssa/builder.go:598 +0x3db
golang.org/x/tools/go/ssa.(*builder).localValueSpec(0xc03ae62f00?, 0xc03ae62f00, 0xc02b42f680)
        golang.org/x/[email protected]/go/ssa/builder.go:1147 +0xe5
golang.org/x/tools/go/ssa.(*builder).stmt(0xc03a8c7598?, 0xc03ae62f00, {0x1f63000?, 0xc02b4474a0?})
        golang.org/x/[email protected]/go/ssa/builder.go:2147 +0x17c5
golang.org/x/tools/go/ssa.(*builder).stmtList(0xc03f0b0f60?, 0xc03a8c75e8?, {0xc02a228f80?, 0x8, 0xc03a8c7638?})
        golang.org/x/[email protected]/go/ssa/builder.go:946 +0x45
golang.org/x/tools/go/ssa.(*builder).stmt(0xc03ae62f00?, 0xc03ae62f00, {0x1f62eb0?, 0xc02b452690?})
        golang.org/x/[email protected]/go/ssa/builder.go:2277 +0x859
golang.org/x/tools/go/ssa.(*builder).buildFunctionBody(0x15486b1?, 0xc03ae62f00)
        golang.org/x/[email protected]/go/ssa/builder.go:2391 +0x437
golang.org/x/tools/go/ssa.(*builder).buildFunction(0x1548700?, 0xc03ae62f00)
        golang.org/x/[email protected]/go/ssa/builder.go:2326 +0x2e
golang.org/x/tools/go/ssa.(*builder).buildCreated(0xc03a8c7a38)
        golang.org/x/[email protected]/go/ssa/builder.go:2413 +0x25
golang.org/x/tools/go/ssa.(*Package).build(0xc03a69b100)
        golang.org/x/[email protected]/go/ssa/builder.go:2606 +0xc86
sync.(*Once).doSlow(0xc03822a300?, 0xc03657b4a0?)
        sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        sync/once.go:65
golang.org/x/tools/go/ssa.(*Package).Build(...)
        golang.org/x/[email protected]/go/ssa/builder.go:2477
golang.org/x/tools/go/analysis/passes/buildssa.run(0xc0382101e0)
        golang.org/x/[email protected]/go/analysis/passes/buildssa/buildssa.go:72 +0x1a8
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc002d3aae0)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:195 +0xa25
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:113 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0014548c0, {0x1d14c9e, 0x8}, 0xc0016a8748)
        github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc000df11a0?)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:112 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc002d3aae0)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x208 
INFO [linters_context/goanalysis] analyzers took 1m46.786203802s with top 10 stages: buildir: 1m13.877090744s, buildssa: 10.483011993s, inspect: 3.036135885s, fact_deprecated: 2.02174336s, printf: 1.927970901s, fact_purity: 1.908516224s, ctrlflow: 1.806664861s, nilness: 1.698415994s, SA5012: 1.260718898s, typedness: 1.176810511s 
ERRO [runner] Panic: nilerr: package "ent" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildssa.SSA: goroutine 14544 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:109 +0x285
panic({0x1bd8800, 0xc03f0b63c0})
        runtime/panic.go:884 +0x213
github.com/gostaticanalysis/nilerr.run(0xc03e4b9950)
        github.com/gostaticanalysis/[email protected]/nilerr.go:28 +0x3f1
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc002d3aa50)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:195 +0xa25
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:113 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0014548c0, {0x1d06d14, 0x6}, 0xc001a09f48)
        github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc000f38a80?)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:112 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc002d3aa50)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x208 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: nilerr: package "ent" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildssa.SSA 
INFO [runner] processing took 6.716µs with stages: max_same_issues: 1.72µs, skip_dirs: 586ns, nolint: 535ns, identifier_marker: 329ns, autogenerated_exclude: 311ns, max_from_linter: 300ns, exclude: 274ns, filename_unadjuster: 257ns, uniq_by_line: 253ns, source_code: 251ns, cgo: 214ns, diff: 186ns, skip_files: 182ns, path_prettifier: 180ns, exclude-rules: 178ns, path_shortener: 178ns, max_per_file_from_linter: 166ns, severity-rules: 165ns, sort_results: 155ns, fixer: 154ns, path_prefixer: 142ns 
INFO [runner] linters took 34.328277355s with stages: goanalysis_metalinter: 34.328146955s 
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: goanalysis_metalinter: nilerr: package "ent" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildssa.SSA
 
INFO Memory: 328 samples, avg is 570.6MB, max is 1107.4MB 
INFO Execution took 38.029865705s 

Code example or link to a public repository

// add your code here

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions