Skip to content

No recursive directory scan when one of the arg is a .go file #1081

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
danmx opened this issue May 10, 2020 · 3 comments · Fixed by #4566
Closed

No recursive directory scan when one of the arg is a .go file #1081

danmx opened this issue May 10, 2020 · 3 comments · Fixed by #4566
Labels
bug Something isn't working

Comments

@danmx
Copy link

danmx commented May 10, 2020

I've noticed that when trying to scan selected directories and .go files to scan instead of using ./... I get an error:

$ golangci-lint run main.go pkg/...
ERRO Running error: context loading failed: failed to load program with go/packages: -: named files must be .go files: ./pkg/...

but when I just scan directories everything works fine:

golangci-lint run cmd/... pkg/... . && echo $?
0
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.26.0 built from 6bd10d0 on 2020-05-01T15:26:22Z
Config file
$ cat .golangci.yml
run:
  deadline: 5m
  tests: true
  skip-dirs:
  - .git
  - bazel-*
  - tools
  - docs
linters-settings:
  # depguard:
  #   list-type: blacklist
  #   packages:
  #     # logging is allowed only by logutils.Log, logrus
  #     # is allowed to use only in logutils package
  #     - github.com/sirupsen/logrus
  #   packages-with-error-message:
  #     - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
  dupl:
    threshold: 100
  # funlen:
  #   lines: 100
  #   statements: 50
  goconst:
    min-len: 2
    min-occurrences: 2
  gocritic:
    enabled-tags:
      - diagnostic
      - experimental
      - opinionated
      - performance
      - style
    disabled-checks:
      - dupImport # https://github.com/go-critic/go-critic/issues/845
      - ifElseChain
      - octalLiteral
      # - whyNoLint
      - wrapperFunc
  gocyclo:
    min-complexity: 15
  goimports:
    local-prefixes: github.com/danmx/sigil
  golint:
    min-confidence: 0
  gomnd:
    settings:
      mnd:
        checks: argument,case,condition,return,operation,assign
  govet:
    check-shadowing: true
  # lll:
  #   line-length: 100
  maligned:
    suggest-new: true
  misspell:
    locale: UK

linters:
  disable-all: true
  enable:
    - bodyclose
    - deadcode
    - depguard
    - dogsled
    - dupl
    - errcheck
    # - funlen
    # - gochecknoinits
    - goconst
    - gocritic
    - gocyclo
    - gofmt
    - goimports
    - golint
    - gomnd
    - goprintffuncname
    - gosec
    - gosimple
    - govet
    - ineffassign
    - interfacer
    # - lll
    - misspell
    - nakedret
    # - rowserrcheck
    - scopelint
    - staticcheck
    - structcheck
    - stylecheck
    - typecheck
    - unconvert
    - unparam
    - unused
    - varcheck
    - whitespace
Go environment
$ go version && go env
go version go1.14.2 darwin/amd64

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/danieliziourov/Library/Caches/go-build"
GOENV="/Users/danieliziourov/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/danieliziourov/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.2_1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.2_1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="0"
GOMOD="/Users/danieliziourov/git/public/danmx/sigil/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sy/lqws73317qsdcchxfd0xdy140000gp/T/go-build378746692=/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/danieliziourov/git/public/danmx/sigil /Users/danieliziourov/git/public/danmx /Users/danieliziourov/git/public /Users/danieliziourov/git /Users/danieliziourov /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 31 linters: [bodyclose deadcode depguard dogsled dupl errcheck goconst gocritic gocyclo gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace]
INFO [lintersdb] Active 31 linters: [bodyclose deadcode depguard dogsled dupl errcheck goconst gocritic gocyclo gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|files|imports|exports_file|name|types_sizes) took 667.380191ms
INFO [runner/enabledLinters] Active 31 linters: [bodyclose deadcode depguard dogsled dupl errcheck goconst gocritic gocyclo gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace]
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 1.471968ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 13.545470697s with top 10 stages: buildssa: 8.843422265s, fact_deprecated: 594.013891ms, inspect: 508.637436ms, printf: 489.334017ms, ctrlflow: 485.319842ms, fact_purity: 435.440637ms, goimports: 286.340722ms, dupl: 249.962754ms, gocritic: 243.854117ms, gosec: 188.269735ms
INFO [runner/unused/goanalysis] analyzers took 310.859249ms with top 10 stages: buildssa: 274.940064ms, U1000: 35.919185ms
INFO [runner] Issues before processing: 63, after processing: 0
INFO [runner] Processors filtering stat (out/in): nolint: 0/2, skip_dirs: 63/63, autogenerated_exclude: 33/63, identifier_marker: 33/33, filename_unadjuster: 63/63, skip_files: 63/63, exclude-rules: 2/2, exclude: 2/33, cgo: 63/63, path_prettifier: 63/63
INFO [runner] processing took 29.652262ms with stages: path_prettifier: 25.215498ms, autogenerated_exclude: 1.677424ms, exclude: 770.848µs, skip_dirs: 689.098µs, nolint: 678.447µs, identifier_marker: 591.042µs, cgo: 21.72µs, filename_unadjuster: 5.274µs, max_same_issues: 875ns, uniq_by_line: 453ns, skip_files: 338ns, diff: 265ns, exclude-rules: 261ns, max_from_linter: 232ns, source_code: 187ns, path_shortener: 153ns, max_per_file_from_linter: 147ns
INFO [runner] linters took 3.925129365s with stages: goanalysis_metalinter: 3.543967994s, unused: 351.423081ms
INFO File cache stats: 21 entries of total size 78.1KiB
INFO Memory: 48 samples, avg is 339.7MB, max is 541.1MB
INFO Execution took 4.616693116s
@danmx danmx added the bug Something isn't working label May 10, 2020
@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent correspondence or work activity label Jun 2, 2021
@stale stale bot closed this as completed Jul 8, 2021
@autarch
Copy link

autarch commented Aug 5, 2022

I'm seeing the same issue. Why have the bot mark issues closed simply because there's been no response? It's still a bug.

@autarch
Copy link

autarch commented Aug 5, 2022

Also, this is a dupe of #942, which has also been marked closed by the bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants