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

gopls not working, but working in VS Code #427

Open
2 tasks done
alexxGmZ opened this issue Jun 15, 2024 · 0 comments
Open
2 tasks done

gopls not working, but working in VS Code #427

alexxGmZ opened this issue Jun 15, 2024 · 0 comments

Comments

@alexxGmZ
Copy link

Problem description

I installed gopls using Mason, so far it successfully installed but when I use the LSP it doesn't work and it keeps on giving me this error according to :Trouble diagnostics.

    ~/Documents/go_practice/  2 
   ├╴  go.mod  1 
   │ └╴󰅚  packages.Load error: err: exit status 1: stderr: malformed import path "{{context.Compiler}}": invalid char '{'
   │      malformed import path "--": leading dash go list  [1, 1]
   └╴  main.go  1 
     └╴󰀪  initialization failed: packages.Load error: err: exit status 1: stderr: malformed import path "{{context.Compiler}}": invalid char '{'
          malformed import path "--": leading dash go list  [1, 9]

I'm confident to say that I installed the latest Go version according to their documentation. I even reached out to r/neovim but the problem is still unsolved. This is my post in r/neovim.

My temporary fix for now is to use VS Code.

Why do you think this is an issue with mason-lspconfig.nvim?

I don't know if it's really the fault of mason-lspconfig.nvim. All I know is that I installed gopls using mason.

Neovim version (>= 0.7)

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

Operating system/version

Linux Mint 5.15.0-112-generic #122-Ubuntu SMP Thu May 23 07:48:21 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

  • Yes

Affected language servers

gopls

Steps to reproduce

  1. Installed latest Go version (1.22.4).
  2. Setup environment variables in shell dotfile.
  3. Install gopls using Mason.
  4. Then do LspStart command.

Actual behavior

The gopls diagnostic is stuck in some import problem so overall it's unusable.

Expected behavior

I expect gopls to work properly.

LspInfo

Press q or <Esc> to close this window. Press <Tab> to view server doc.
 
 Language client log: /home/alex/.local/state/nvim/lsp.log
 Detected filetype:   trouble
 
 0 client(s) attached to this buffer: 
 
 1 active client(s) not attached to this buffer: 
 
 Client: gopls (id: 1, bufnr: [1])
 	filetypes:       go, gomod, gowork, gotmpl
 	autostart:       false
 	root directory:  /home/alex/Documents/go_practice
 	cmd:             /home/alex/.local/share/nvim/mason/bin/gopls
 
 Configured servers list: html, bashls, pyright, jdtls, clangd, lua_ls, intelephense, vimls, cssls, marksman, texlab, lemminx, quick_lint_js, tsserver, jsonls, gopls

LspLog

No response

Healthcheck

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-06-15-graceful-iguana` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
- OK wget: `GNU Wget 1.21.2 built on linux-gnu.`
- OK curl: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.17`
- OK gzip: `gzip 1.10`
- OK tar: `tar (GNU tar) 1.34`
- OK bash: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- OK Ruby: `ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]`
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Go: `go version go1.22.4 linux/amd64`
- OK node: `v18.17.1`
- OK cargo: `cargo 1.75.0`
- OK luarocks: `/usr/bin/luarocks 3.8.0`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.10.12`
- OK RubyGem: `3.3.5`
- OK java: `openjdk version "17.0.7" 2023-04-18`
- OK pip: `pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)`
- OK python venv: `Ok`
- OK javac: `javac 17.0.7`
- OK npm: `9.4.2`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Sunday, 16 June, 2024 12:16:32 AM.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

Refer to my r/neovim post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant