intellij-lsp
intellij-lsp copied to clipboard
How can I use gopls?
Error
When I use gopls, the following error occurred.


panic: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr:
goroutine 74 [running]:
golang.org/x/tools/internal/lsp/debug.PrintVersionInfo.func2()
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/debug/info.go:58 +0x22e
golang.org/x/tools/internal/lsp/debug.section(0x1a550e0, 0xc00036b950, 0x0, 0x18eda74, 0x7, 0xc000366fe0)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/debug/info.go:69 +0x319
golang.org/x/tools/internal/lsp/debug.PrintVersionInfo(0x1a68300, 0xc000234980, 0x1a550e0, 0xc00036b950, 0x1, 0x0)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/debug/info.go:52 +0x1a7
golang.org/x/tools/internal/lsp.(*Server).initialize(0xc000216800, 0x1a68300, 0xc000234980, 0xc000358000, 0x0, 0x0, 0x0)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/general.go:79 +0x5fb
golang.org/x/tools/internal/lsp.(*Server).Initialize(0xc000216800, 0x1a68300, 0xc000234980, 0xc000358000, 0xc000358000, 0x0, 0x0)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/server_gen.go:108 +0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0x1a68300, 0xc000234980, 0x1a82780, 0xc000216800, 0xc00034f980, 0x1a68540, 0xc000234900, 0x0, 0x0, 0xbfbce1aeba393278)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/tsserver.go:235 +0x485
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x1a68300, 0xc000234980, 0xc00034f980, 0x1a68540, 0xc000234900, 0x0, 0x0)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/protocol.go:62 +0xc0
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x1a68300, 0xc000234980, 0xc00034f980, 0x1a68540, 0xc000234900, 0x0, 0x0)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/lsp/lsprpc/lsprpc.go:509 +0x40e
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0x1a68300, 0xc000234980, 0xc000236660, 0x1a68540, 0xc000234900, 0x1007a9f, 0xc000210658)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:35 +0xd3
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc000210b40, 0xc00022f6e0, 0xc0002051b0, 0x1a68300, 0xc000234980, 0xc000236660, 0x1a68540, 0xc000234900)
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
/Users/yyh-gl/workspaces/Go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:100 +0x171
My server definitions

Inquiry
The error log show "go command required, not found". But I already installed go and the go command works normally. I don't know what the cause is intellij-lsp or my setting.
Do you have some solution?
Many thanks.