Skip to content

Exclude doesn't work with filenames in the regexp #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
schoentoon opened this issue Nov 21, 2018 · 3 comments
Closed

Exclude doesn't work with filenames in the regexp #300

schoentoon opened this issue Nov 21, 2018 · 3 comments
Labels
enhancement New feature or improvement

Comments

@schoentoon
Copy link

I'm trying to exclude the global variable check on the cmd/ directory. I thought about using the exclude config for this, however cmd\/.+is a global variable regex doesn't seem to work for this as it only seems to match against the actual message from the linter and not the file/line number.

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version
    golangci-lint has version 1.12 built from 7836034 on 2018-11-07T09:03:53Z
  2. Config file: cat .golangci.yml
[run]
tests = false

[linters]
enable-all = true
disable = ["typecheck", "goconst", "goimports"]

[issues]
exclude = [ 
  "cmd\/.+is a global variable"
]
  1. Go environment: go version && go env
go version go1.11.2 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/<user>/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/<user>/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<user>/git/<project>/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qk/76c0lh7166nbz10bntlqwqw80000gn/T/go-build965110773=/tmp/go-build -gno-record-gcc-switches -fno-common"
@jirfag
Copy link
Contributor

jirfag commented Nov 23, 2018

hi!
it's the nice feature to have, pull requests are welcome (we need to change just exclude processor and add needed unit tests).

Maybe skip-files option can help you while it's not ready.

@schoentoon
Copy link
Author

I don't want to skip all linters on cmd/ just this specific one. I'll see on Monday if I can build something into it.

@tpounds tpounds added the enhancement New feature or improvement label Oct 1, 2019
@jirfag
Copy link
Contributor

jirfag commented Oct 15, 2019

see exclude-rules: it's what you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

3 participants