xxpxxxxp / intellij-plugin-golangci-lint

GolangCI-Lint integration for IDEA
GNU General Public License v3.0
219 stars 15 forks source link

Monorepo in Goland: Running error: context loading failed #162

Open kelzenberg opened 1 month ago

kelzenberg commented 1 month ago

I have a monorepo with several projects, some Go, some other languages. Each Go project includes its own go.mod and a .golangci.yaml and I assumed that the linter plugin would respect these when I uncheck "Project Root" in the config (as described in the Readme).

Unfortunately I still get errors every time I save a file.

/opt/homebrew/bin/golangci-lint run --disable=typecheck /Users/xxx/Developer/foo/project-a/internal
level=error msg="Running error: context loading failed: no go files to analyze: running `go mod tidy` may solve the problem"

I checked this issue but couldn't find an answer regarding monorepos like mine.

I believe it has something to do with the file watcher as this errors persists even after deactivating the plugin. Any assistance debugging this is much appreciated.

Goland log:

2024-07-31 10:46:58,585 [  34452]   WARN - go-linter - Run error: level=error msg="Running error: context loading failed: no go files to analyze: running `go mod tidy` may solve the problem"
. Please make sure the project has no syntax error.
2024-07-31 10:46:58,586 [  34453]   WARN - go-linter - Debug command: cd '/Users/xxx/Developer/foo' && export PATH='/Users/xxx/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.darwin-arm64/bin:/usr/bin:/bin:/usr/sbin:/sbin' && export GOPATH='' && export GO111MODULE='on' && '/opt/homebrew/bin/golangci-lint' 'run' '--out-format' 'json' '--allow-parallel-runners' '-j' '8' '--issues-exit-code' '1' '--max-issues-per-linter' '0' '--max-same-issues' '0' '--no-config' '--disable-all' '-E' 'staticcheck,govet,errcheck,ineffassign,unused,gosimple' 'project-a/cmd'

GoLand 2024.1.4 Build #GO-241.18034.61, built on June 20, 2024 Runtime version: 17.0.11+1-b1207.24 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.5