Skip to content

x/tools/gopls: Error loading packages: invalid workspace folder path: no such file or directory #63381

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

Open
aruneshpa opened this issue Oct 5, 2023 · 0 comments
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@aruneshpa
Copy link

I am using gopls in Emacs to connect to a remote workspace over SSH (using tramp).

Local machine is running Mac OSX and remote is Linux.

Remote gopls version

On remote:

$ gopls -v version                                                                                                                                    1 ↵
Build info
----------
golang.org/x/tools/gopls v0.13.2
    golang.org/x/tools/[email protected] h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=
    github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
    golang.org/x/exp/[email protected] h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/[email protected] h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
    golang.org/x/[email protected] h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
    golang.org/x/[email protected] h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
    golang.org/x/[email protected] h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
    golang.org/x/[email protected] h1:Oush7UwPamr2/iNeNFBuNFj89YyHn0YY69EKDdvANnk=
    golang.org/x/[email protected] h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
    honnef.co/go/[email protected] h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
    mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.20.8

Remote go env

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="<redacted>"
GOENV="<redacted>"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="<redacted>"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="<redacted>"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="<redacted>"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="<redacted>"
GOVCS=""
GOVERSION="go1.20.8"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2897107243=/tmp/go-build -gno-record-gcc-switches"

Local gopls version

$ gopls -v version
Build info
----------
golang.org/x/tools/gopls v0.13.2
    golang.org/x/tools/[email protected] h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=
    github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
    golang.org/x/exp/[email protected] h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/[email protected] h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
    golang.org/x/[email protected] h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
    golang.org/x/[email protected] h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
    golang.org/x/[email protected] h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
    golang.org/x/[email protected] h1:Oush7UwPamr2/iNeNFBuNFj89YyHn0YY69EKDdvANnk=
    golang.org/x/[email protected] h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
    honnef.co/go/[email protected] h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
    mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.20.4

Local go env

$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="<redacted>"
GOENV="<redacted>"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="<redacted>"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="<redacted>"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4g/g02xvq957bn8bjr6wdvs1sgm0000gr/T/go-build880898998=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

When lsp-mode (LSP client that I am using for Emacs) tries to open a file, I am seeing the following message returned from the server:

[Trace - 05:56:20 PM] Received notification '$/progress'.
Params: {
  "token": "5105710039192624326",
  "value": {
    "kind": "end",
    "message": "Error loading packages: invalid workspace folder path: no such file or directory; check that the casing of the configured workspace folder path agrees with the casing reported by the operating system"
  }
}

[Trace - 05:56:20 PM] Received notification 'window/showMessage'.
Params: {
  "type": 1,
  "message": "Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///<file-path>: invalid workspace folder path: no such file or directory; check that the casing of the configured workspace folder path agrees with the casing reported by the operating system\n"
}

And then finally, lsp-mode bails with:

[Trace - 05:56:20 PM] Received response 'nil - (186)' in 0ms.
Result: {
  "code": -32800,
  "message": "JSON RPC cancelled"
}


[Trace - 05:56:20 PM] Received response 'textDocument/codeLens - (187)' in 99ms.
Result: {
  "code": 0,
  "message": "no views in session"
}

What did you expect to see?

gopls server should have correctly recognized the folder.

What did you see instead?

The error attached above.

Editor and settings

Editor:

  "clientInfo": {
    "name": "emacs",
    "version": "GNU Emacs 29.1 (build 2, aarch64-apple-darwin22.6.0, NS appkit-2299.70 Version 13.5 (Build 22G74))\n of 2023-08-18"
  },

lsp mode editor settings:

(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :init
  (setq lsp-keymap-prefix "C-c l")
  :config
  (setq lsp-prefer-flymake nil)
  (lsp-enable-which-key-integration t)
  ;; lsp remote clients
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-stdio-connection "gopls")
                    :major-modes '(go-mode go-dot-mod-mode go-ts-mode go-mod-ts-mode)
                    :language-id "go"
                    :remote? t
                    :priority 0
                    :server-id 'gopls-remote
                    ))
  :hook
  ((c-mode c++-mode java-mode python-mode go-mode go-ts-mode go-dot-mod-mode go-mod-ts-mode python-ts-mode) . lsp))
;; lsp-ui for minimal UI features
(use-package lsp-ui
  :hook (lsp-mode . lsp-ui-mode)
  :config
  (setq lsp-ui-doc-enable nil))
@aruneshpa aruneshpa added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Oct 5, 2023
@gopherbot gopherbot added this to the Unreleased milestone Oct 5, 2023
@hyangah hyangah modified the milestones: Unreleased, gopls/backlog Oct 5, 2023
@adonovan adonovan removed their assignment Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants