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: vim-installed gopls@v0.14.2 does not work (but command-line installed gopls@v0.14.2 is OK) #64889

Closed
Goclipse27 opened this issue Dec 28, 2023 · 7 comments
Labels
Documentation 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.
Milestone

Comments

@Goclipse27
Copy link
Contributor

ATTENTION: Please answer these questions BEFORE submitting your issue. Thanks!

What did you do?

If possible, provide a recipe for reproducing the error.
For a Vim based editor, the editor takes care of lsp -> gopls configured. But gopls is not working as expected, however when I did a

go install -v golang.org/x/tools/gopls@latest

And try to copy binary to vim configured location that works expected.

Both the gopls show the version as
golang.org/x/tools/gopls v0.14.2
golang.org/x/tools/gopls@v0.14.2 h1:sIw6vjZiuQ9S7s0auUUkHlWgsCkKZFWDHmrge8LYsnc=

What did you expect to see?

Both gopls are of same version I was expecting both to work.

What did you see instead?

One is working and other is not , I am seeing both the binaries are of different size but same version. Is there a way to find the diff ?

Below is the LSP log error :

[ERROR][2023-12-28 08:27:26] ...lsp/handlers.lua:535 "2023/12/28 08:27:26 no signature help: cannot find an enclosing function\n\tposition=7:10\n"
[START][2023-12-28 08:50:17] LSP logging initiated
[ERROR][2023-12-28 08:50:17] ...lsp/handlers.lua:535 "2023/12/28 08:50:17 tidy: diagnosing file:///home/ragul/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.4.linux-amd64/src/go.mod: err: exit status 1: stderr: go: downloading golang.org/x/crypto v0.11.1-0.20230711161743-2e82bdd1719d\ngo: downloading golang.org/x/net v0.12.1-0.20231027154334-5ca955b1789c\ngo: std/crypto/ecdsa imports\n\tgolang.org/x/crypto/cryptobyte: module lookup disabled by GOPROXY=off\ngo: std/crypto/ecdsa imports\n\tgolang.org/x/crypto/cryptobyte/asn1: module lookup disabled by GOPROXY=off\ngo: std/crypto/tls imports\n\tgolang.org/x/crypto/chacha20poly1305: module lookup disabled by GOPROXY=off\ngo: std/crypto/tls imports\n\tgolang.org/x/crypto/hkdf: module lookup disabled by GOPROXY=off\ngo: std/net imports\n\tgolang.org/x/net/dns/dnsmessage: module lookup disabled by GOPROXY=off\ngo: std/net imports\n\tgolang.org/x/net/lif: module lookup disabled by GOPROXY=off\ngo: std/net imports\n\tgolang.org/x/net/route: module lookup disabled by GOPROXY=off\ngo: std/net/http imports\n\tgolang.org/x/net/http/httpguts: module lookup disabled by GOPROXY=off\ngo: std/net/http imports\n\tgolang.org/x/net/http/httpproxy: module lookup disabled by GOPROXY=off\ngo: std/net/http imports\n\tgolang.org/x/net/http2/hpack: module lookup disabled by GOPROXY=off\ngo: std/net/http imports\n\tgolang.org/x/net/idna: module lookup disabled by GOPROXY=off\ngo: std/crypto/ecdh tested by\n\tstd/crypto/ecdh.test imports\n\tgolang.org/x/crypto/chacha20: module lookup disabled by GOPROXY=off\ngo: std/net tested by\n\tstd/net.test imports\n\tgolang.org/x/net/nettest: module lookup disabled by GOPROXY=off\n\n"

Build info

golang.org/x/tools/gopls v0.14.2
    golang.org/x/tools/gopls@v0.14.2 h1:sIw6vjZiuQ9S7s0auUUkHlWgsCkKZFWDHmrge8LYsnc=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
    golang.org/x/sync@v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
    golang.org/x/sys@v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
    golang.org/x/telemetry@v0.0.0-20231114163143-69313e640400 h1:brbkEFfGwNGAEkykUOcryE/JiHUMMJouzE0fWWmz/QU=
    golang.org/x/text@v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
    golang.org/x/tools@v0.14.1-0.20231114185516-c9d3e7de13fd h1:Oku7E+OCrXHyst1dG1z10etCTxewCHXNFLRlyMPbh3w=
    golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
    honnef.co/go/tools@v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo=
    mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: devel go1.22-46ea4ab Sat Dec 9 21:48:06 2023 +0000

Please let me know if you need more details.

@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 Dec 28, 2023
@gopherbot gopherbot added this to the Unreleased milestone Dec 28, 2023
@Goclipse27
Copy link
Contributor Author

cc @findleyr

@findleyr findleyr changed the title x/tools/gopls: gopls v0.14.2 is not working as expected (for example : show documentation or go to definition) x/tools/gopls: vim-installed gopls@v0.14.2 does not work (but command-line installed gopls@v0.14.2 is OK) Dec 28, 2023
@findleyr
Copy link
Member

Sounds like they were built with different versions of Go. Can you do gopls -v version for both, and share both full outputs?

@Goclipse27
Copy link
Contributor Author

Not working version mentioned below, the other version mentioned above works. One more information, when I have go 1.22 in my PATH, gopls in vim go 1.21.0 , was having issue but when I change to PATH go 1.21 version, vim gopls does it work.

So i tried replacing gopls with go install with go 1.22

Build info
----------
golang.org/x/tools/gopls v0.14.2
    golang.org/x/tools/gopls@v0.14.2 h1:sIw6vjZiuQ9S7s0auUUkHlWgsCkKZFWDHmrge8LYsnc=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
    golang.org/x/sync@v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
    golang.org/x/sys@v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
    golang.org/x/telemetry@v0.0.0-20231114163143-69313e640400 h1:brbkEFfGwNGAEkykUOcryE/JiHUMMJouzE0fWWmz/QU=
    golang.org/x/text@v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
    golang.org/x/tools@v0.14.1-0.20231114185516-c9d3e7de13fd h1:Oku7E+OCrXHyst1dG1z10etCTxewCHXNFLRlyMPbh3w=
    golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
    honnef.co/go/tools@v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo=
    mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.21.0

@hyangah
Copy link
Contributor

hyangah commented Jan 4, 2024

@raghvenders What is the go version of your project's go.mod or go.work file? You mentioned go1.22. If the project requires go1.22 or you are using go1.22, gopls needs to be built with go1.22 or a newer version. I am not sure how vim installs gopls. Can you check if vim uses go1.22 (not yet released)?

@hyangah hyangah added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 4, 2024
@Goclipse27
Copy link
Contributor Author

@hyangah - My project is go 1.21.x, vim installs gopls with go 1.21.x and does it work. But when I do go1.22 development, I updated PATH to devel go1.22. Once I have done that, gopls which already got installed in
/.local/share/lvim/mason/packages/gopls, is unable to accomplish language functionalities.

We have to have gopls installed with go1.22(Manually). This I did not encounter at vscode editor, where gopls is identified or installed when editor is reload with command of local development go 1.22 is configured

choose go env

@Goclipse27
Copy link
Contributor Author

@hyangah - One relatable reason could be vim lsp packages for go - gopls is installed and used on a its own package dependencies (mason) location rather than a GOPATH.

@Goclipse27
Copy link
Contributor Author

It is installing if we do it manually. No issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 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

4 participants