go在 emacs 中,使用 gopls 但在我的路径上找不到。但它就在那里,我可以运行它。与社区联系,看看我是否遗漏了什么。我可以毫无问题地运行基本的杜松子酒服务器。使用此配置,来自文档。输出: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 +0x1c3golang.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 +0x319golang.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 +0x1a7golang.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 +0x1a3golang.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 +0x49golang.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 +0x757golang.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 +0x505golang.org/x/tools/internal/jsonrpc2.MustReply.func1(0x1a40560, 0xc000226c60, 0xc00022cd80, 0x1007aaf, 0xc0002901d8)Process gopls stderr finished
1 回答
慕工程0101907
TA贡献1887条经验 获得超5个赞
一个猜测:PATH与您正在运行的任何其他 shell 相比,Emacs 中的 env var 可能有所不同。你可以(getenv "PATH")在 Emacs 中检查,你可以设置它
(setenv "PATH" (concat (getenv "PATH") ":/path/to/go"))
此外,如果您从可以找到的同一个 shell 启动 Emacs gopls,Emacs 应该具有相同的PATHvar 并且一切都应该工作。
至于为什么s 不同,这PATH与你如何启动 Emacs 和你的 shell 有关。
- 1 回答
- 0 关注
- 215 浏览
添加回答
举报
0/150
提交
取消
