Skip to content
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

x/tools/gopls: Exhausted failed to load view #45171

Closed
iamshreeram opened this issue Mar 23, 2021 · 2 comments
Closed

x/tools/gopls: Exhausted failed to load view #45171

iamshreeram opened this issue Mar 23, 2021 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@iamshreeram
Copy link

iamshreeram commented Mar 23, 2021

Issue

I use multi-module workspace (kinda monorepo). I'm getting an error from gopls that says -

Error loading workspace folders (expected 11, got 9) failed to load view for file:///Users/sram/ram/project: exhausted failed to load view for file:///Users/sram/ram/project/node: exhausted

gopls is looking for my node directory in my project workspace.

Below is the directory structure of my workspace:

my-workspace
~
 | /.config
 | /.cabal/
 | /.nvm/
 | .bash_profile
 | .bashrc
 | /project/
 |  | /Clojure/
 |  |  | /allmycljprojects 
 |  | /Shell/
 |  |  | /allmybashprojects 
 |  | /rust/
 |  |  | /allmyrustprojects
 |  | /haskell/
 |  |  | /allmyhaskellprojects
 |  | /python/
 |  |  | /allmypythonprojects 
 |  | /go/
 |  |  | /bin
 |  |  | /pkg
 |  |  | /src
 |  |  |  | /github.com
 |  |  |  | /gitlab.com
 |  |  |  | /golang.org
 |  |  |  | /gopkg.in
 |  | /scala/
 |  |  | /allmyscalaprojects
 |  | /node/
 |  |  | /allmynodeprojects

Fix

I would want to enable directory filters (directoryFilters) to explicitly say gopls to stop looking at node directory or node_modules in specific project path OR I want gopls to look at only the go directory in my project folder

Could you please help if below is right format? Will below help in specifying gopls to look only at go directory

"gopls": {
     // "experimentalWorkspaceModule": true,
     "directoryFilters": ["+/~/project/go/"],
      ....
  }

Or Would I be able to use

"gopls": {
     // "experimentalWorkspaceModule": true,
     "directoryFilters":["-/Users/sram/ram/project/node/","-node_modules"],
      ....
  }

to make gopls to ignore all node directory?

***** Other details ******

What version of Go are you using (go version)?

$ go version
go version go1.15.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes. I was seeing this issue even in earlier versions of gopls

What operating system and processor architecture are you using (go env)?

go env
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sram/Library/Caches/go-build"
GOENV="/Users/sram/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/sram/ram/project/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sram/ram/project/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/sn/pw7xq23n2vj_wnq16lkgdrxh0000gn/T/go-build150007759=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you expect to see?

No errors from gopls.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 23, 2021
@gopherbot gopherbot added this to the Unreleased milestone Mar 23, 2021
@stamblerre
Copy link
Contributor

I believe you would want something like the following:

"gopls": {
     "directoryFilters":["-/Users/s0v00nr/ram/project","+/Users/s0v00nr/ram/project/go"],
}

if you only want gopls to look at the go directory.

/cc @heschi for confirmation

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Mar 30, 2021
@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 30, 2021
@iamshreeram
Copy link
Author

Thanks! That worked. Below is my current config -

    "gopls": {
        "ui.documentation.hoverKind": "SynopsisDocumentation",
        "build.directoryFilters":["-/Users/sram/ram/project","+/Users/sram/ram/project/go"],
        "build.experimentalWorkspaceModule": true,          
     }

@stamblerre stamblerre removed this from the gopls/v1.0.0 milestone Apr 1, 2021
@golang golang locked and limited conversation to collaborators Apr 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants