Skip to content

issues.exclude-dirs not behaving as expected #5438

@gakesson

Description

@gakesson

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

Official binary

Description of the problem

The issues.exclude-dirs configuration is ignored in case lint failure is due to typecheck linter.
This is a bit unintuitive that even explicitly excluded directories are failing a specific linter, and after some digging in the golangci-lint code it seems it is related to this PR.

This is a bit problematic when there is CI/CD tasks populate code that does not pass this linter, in build/CI/CD related directories not intended to be linted. Only workaround I have right now is to explicitly point out the directories that should be linted, which is a bit tedious.

Is this considered a bug or is it possible to have another config-option to instruct golangci-lint to not use typecheck linter even in certain directories?

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.64.4 built with go1.24.0 from 04aec4f7 on 2025-02-12T21:58:21Z

Configuration

run:
  tests: false
  timeout: 5m
issues:
  exclude-dirs:
    - build

Go environment

$ go version && go env
go version && go env
go version go1.23.6 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/golang/pkg/mod'
GONOPROXY='comp.com/*'
GONOSUMDB='comp.com/*'
GOOS='linux'
GOPATH='/home/user/golang'
GOPRIVATE='comp.com/*'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/user/golang/pkg/mod/golang.org/[email protected]'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/user/golang/pkg/mod/golang.org/[email protected]/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.6'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/user/git/org/bridge/go.mod'
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3213195946=/tmp/go-build -gno-record-gcc-switches

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
N/A

A minimal reproducible example or link to a public repository

N/A - see issue description

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

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