Skip to content

skip-dirs works with some linters and not with others #913

Closed
@tylerje

Description

@tylerje

Thank you for creating the issue!

  • 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).

Please include the following information:

Version of golangci-lint
$ golangci-lint version
golangci-lint has version 1.22.2 built from cb2f8ba on 2019-12-30T19:26:28Z```
Config file
$ cat .golangci.yml
linters:
  # please, do not use `enable-all`: it's deprecated and will be removed soon.
  # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
  disable-all: true
  enable:
    #notskip- bodyclose
    #notskip-  deadcode
    #notskip- depguard
    #- dogsled
    #- dupl
    #notskip- errcheck
    #- funlen
    #- gochecknoinits
    #- goconst
    #notskip- gocritic
    #- gocyclo
    #- gofmt
    #- goimports
    #- golint
    #notskip- gosec
    #notskip- gosimple
    #notskip- govet
    #- ineffassign
    #notskip- interfacer
    #- lll
    #- misspell
    #- nakedret
    #- scopelint
    #notskip- staticcheck
    #notskip- structcheck
    #notskip- stylecheck
    #- typecheck
    - unconvert
    #notskip- unparam
    #notskip- unused
    #notskip- varcheck
    #- whitespace

    # don't enable:
    #- gochecknoglobals
    #- gocognit
    #- godox
    #notskip- maligned
    #- prealloc

run:
  skip-dirs:
    - api
    - vendor
Go environment
$ go version && go env
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/repo/go:/k10/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/repo/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build302036891=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /repo/go/src /repo/go /repo /] 
INFO [config_reader] Used config file ../../.golangci.yml 
INFO [lintersdb] Active 1 linters: [unconvert]    
INFO [lintersdb] Active 1 linters: [unconvert]    
INFO [loader] Go packages loading at mode 575 (deps|types_sizes|compiled_files|exports_file|files|imports|name) took 2.72833563s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 76.405679ms 
INFO [runner/unconvert/goanalysis] analyzers took 85.820662ms with top 10 stages: unconvert: 85.820662ms 
WARN [runner] Can't run linter unconvert: unconvert: analysis skipped: errors in package: [/repo/go/src/api/.../run.go:57:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../run.go:51:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../retire.go:57:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../retire.go:51:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../restore.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../restore.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../import.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../import.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../export.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../export.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../backup.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../backup.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions)] 
INFO [runner] processing took 2.531µs with stages: max_same_issues: 558ns, skip_dirs: 288ns, nolint: 253ns, max_from_linter: 237ns, cgo: 198ns, path_prettifier: 108ns, autogenerated_exclude: 107ns, skip_files: 104ns, filename_unadjuster: 102ns, exclude-rules: 101ns, max_per_file_from_linter: 100ns, diff: 99ns, identifier_marker: 99ns, uniq_by_line: 48ns, exclude: 46ns, source_code: 42ns, path_shortener: 41ns 
INFO [runner] linters took 1.729615347s with stages: unconvert: 1.729587635s 
ERRO Running error: unconvert: analysis skipped: errors in package: [/repo/go/src/api/.../run.go:57:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../run.go:51:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../retire.go:57:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../retire.go:51:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../restore.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../restore.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../import.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../import.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../export.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../export.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../backup.go:58:19: client.Actions undefined (type client.Interface has no field or method Actions) /repo/go/src/api/.../backup.go:52:19: client.Actions undefined (type client.Interface has no field or method Actions)] 
INFO Memory: 47 samples, avg is 176.6MB, max is 404.3MB 
INFO Execution took 4.545652859s 
Linters that adhere to skip-dirs
  dogsled
  dupl
  funlen
  gochecknoinits
  goconst
  gocyclo
  gofmt
  goimports
  golint
  ineffassign
  lll
  misspell
  nakedret
  scopelint
  typecheck
  whitespace
  gochecknoglobals
  gocognit
  godox
  prealloc
Linters that ignore to skip-dirs
  bodyclose
  deadcode
  depguard
  errcheck
  gocritic
  gosec
  gosimple
  govet
  interfacer
  staticcheck
  structcheck
  stylecheck
  unconvert
  unparam
  unused
  varcheck
  maligned

Perhaps that there is a reason that skip-dirs is ignored with some linters and a non-zero value is returned for errors in those directories, but I cannot seem to find one. Any help would be very welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions