Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

go: better logging if `go install gopls` fails (#8060)

Thorsten Ball80db468720f2
diff --git a/crates/zed/src/languages/go.rs b/crates/zed/src/languages/go.rs
index 83adf45d4b2..ab1e4f7cd68 100644
--- a/crates/zed/src/languages/go.rs
+++ b/crates/zed/src/languages/go.rs
@@ -125,10 +125,16 @@ impl super::LspAdapter for GoLspAdapter {
.args(["install", "golang.org/x/tools/gopls@latest"])
.output()
.await?;
- anyhow::ensure!(
- install_output.status.success(),
- "failed to install gopls. Is `go` installed and in the PATH?"
- );
+
+ if !install_output.status.success() {
+ log::error!(
+ "failed to install gopls via `go install`. stdout: {:?}, stderr: {:?}",
+ String::from_utf8_lossy(&install_output.stdout),
+ String::from_utf8_lossy(&install_output.stderr)
+ );
+
+ return Err(anyhow!("failed to install gopls with `go install`. Is `go` installed and in the PATH? Check logs for more information."));
+ }
let installed_binary_path = gobin_dir.join("gopls");
let version_output = process::Command::new(&installed_binary_path)