[英]Why can't emacs-lsp go-mode not find go executable in path?
在 emacs 中,使用 gopls 但在我的路徑上找不到go
。 但它就在那里,我可以運行它。 與社區聯系,看看我是否遺漏了什么。 我可以毫無問題地運行基本的杜松子酒服務器。
使用此 配置,來自文檔。
Output:
panic: err: exec: "go": executable file not found in $PATH: stderr:
goroutine 73 [running]:
golang.org/x/tools/internal/lsp/debug.PrintVersionInfo.func2()
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/debug/info.go:58 +0x1c3
golang.org/x/tools/internal/lsp/debug.section(0x1a2d520, 0xc00013de60, 0x0, 0x18cda9a, 0x7, 0xc0003bb588)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/debug/info.go:69 +0x319
golang.org/x/tools/internal/lsp/debug.PrintVersionInfo(0x1a40560, 0xc000226c60, 0x1a2d520, 0xc00013de60, 0x1, 0x0)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/debug/info.go:52 +0x1a7
golang.org/x/tools/internal/lsp.(*Server).initialized(0xc000230080, 0x1a40560, 0xc000226c60, 0x1fa2ef0, 0x0, 0x0)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/general.go:163 +0x1a3
golang.org/x/tools/internal/lsp.(*Server).Initialized(0xc000230080, 0x1a40560, 0xc000226c60, 0x1fa2ef0, 0x1fa2ef0, 0x0)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/server_gen.go:112 +0x49
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x1a40560, 0xc000226c60, 0xc00022cd80, 0x1c650b5, 0x1f77a40)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/protocol/tsserver.go:97 +0x757
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x1a40560, 0xc000226c60, 0xc00022cd80, 0x0, 0x0)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/lsprpc/lsprpc.go:531 +0x505
golang.org/x/tools/internal/jsonrpc2.MustReply.func1(0x1a40560, 0xc000226c60, 0xc00022cd80, 0x1007aaf, 0xc0002901d8)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/jsonrpc2/handler.go:54 +0x47
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc00009eb40, 0xc000226de0, 0xc000232130, 0x1a40560, 0xc000226c60, 0xc00022cd80)
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/jsonrpc2/handler.go:110 +0x6c
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
/Users/seanh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/jsonrpc2/handler.go:107 +0x187
Process gopls stderr finished
猜測:與您正在運行的其他 shell 相比,Emacs 中的PATH
環境變量可能不同。 您可以使用 Emacs 中的(getenv "PATH")
進行檢查,並且可以使用
(setenv "PATH" (concat (getenv "PATH") ":/path/to/go"))
此外,如果您從可以找到gopls
的相同 shell 啟動 Emacs ,則 Emacs 應該具有相同的PATH
var,並且一切都應該工作。
至於為什么PATH
不同,它與你如何啟動 Emacs 和你的 shell 有關。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.