Golangci-lint: 1.19.0: no go files to analyze

Created on 30 Sep 2019  ·  11Comments  ·  Source: golangci/golangci-lint

This seems a breaking, undocumented change coming from 1.18.0. Running with 1.18 does find files for linting.

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)

❯ golangci-lint run --version golangci-lint has version 1.19.0 built from 27ac4c7 on 2019-09-23T20:40:07Z

  1. Config file: cat .golangci.yml

````
❯ cat .golangci.yml
issues:
exclude:

  • "sunspecModelID is unused"
  • "printModel is unused"
  • "U1000: func ..sunSpec..sanitizeModels is unused"
  • "U1000: func ..SunSpecCore..snip16int is unused"
  • "U1000: func ..SunSpecCore..snip32 is unused"
    ````
  1. Go environment: go version && go env

❯ go version && go env go version go1.13 darwin/amd64 GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/andig/Library/Caches/go-build" GOENV="/Users/andig/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/andig/htdocs/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org" GOROOT="/usr/local/opt/go/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/andig/htdocs/mbmd/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/w5/_c0nb6n90fn96tzw04dtc6240000gn/T/go-build702025501=/tmp/go-build -gno-record-gcc-switches -fno-common"

  1. Verbose output of running: golangci-lint run -v

` ❯ golangci-lint run -v INFO [config_reader] Config search paths: [./ /Users/andig/htdocs/mbmd /Users/andig/htdocs /Users/andig /Users /] INFO [config_reader] Used config file .golangci.yml INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck] INFO [lintersdb] Optimized sublinters [staticcheck gosimple unused] into metalinter megacheck INFO [loader] Go packages loading at mode 1023 (syntax|types|types_info|compiled_files|deps|name|types_sizes|exports_file|files|imports) took 1.515926345s ERRO Running error: context loading failed: no go files to analyze INFO Memory: 21 samples, avg is 68.9MB, max is 68.9MB INFO Execution took 1.918671903s

bug dependencies feedback required

All 11 comments

I guess it's caused by x/tools update

this is present in v1.20.0 as well.

Executing command: golangci-lint --version                                                                                                                       
golangci-lint has version 1.20.0 built from cc98739 on 2019-10-08T18:36:35Z                                                                                      
------------------------------                                                                                                                                   
Executing command: make lint                                                                                                                                     
golangci-lint -c /codefresh/volume/waas/lint-configs/.golangci.yml      run                                                                                      
Reading environment variable exporting file contents.                                                                                                            
ERRO Running error: context loading failed: no go files to analyze                                                                                                                                                                  
ERRO Timeout exceeded: try increase it by passing --timeout option 

Is there a workaround for this?

Can you run linter with this envs GL_DEBUG=linters_output GOPACKAGESPRINTGOLISTERRORS=1, maybe it will help you understand, what happen ?!

The issue could be caused by the renaming of deadline option to timeout in https://github.com/golangci/golangci-lint/commit/0cc87df732aaf1d5ad9ce9ca538d38d916918b36. So you have to replace deadline with timeout in your config or command-line options.

I‘m not using either option.

Just wanted to note that I had this issue and when I ran GL_DEBUG=linters_output GOPACKAGESPRINTGOLISTERRORS=1 golangci-lint -v run, it made it clear that my go.sum had an integrity issue. I just deleted the go.sum and regenerated it.

I also found the same issue with version 1.20.1, running the analysis with default parameters with the repository referred in the demo (https://github.com/astaxie/beego).

https://github.com/golangci/golangci-lint/issues/825 is this related. Could it be the same issue? That it isn't building that is.

I guess it’s the same

I'm closing this one since I can no longer reproduce the root issue on a different machine. As per comments I'd suggest to check if code is error-free and open separate issue if problem persists.

Was this page helpful?
0 / 5 - 0 ratings