Release Notes: - Improved logging if installing `gopls` fails
Unified · Split
| @@ -125,10 +125,16 @@ impl super::LspAdapter for GoLspAdapter { · 124 unmodified lines | |||
| 125 | .args(["install", "golang.org/x/tools/gopls@latest"]) | 125 | .args(["install", "golang.org/x/tools/gopls@latest"]) |
| 126 | .output() | 126 | .output() |
| 127 | .await?; | 127 | .await?; |
| 128 | anyhow::ensure!( | 128 | |
| 129 | install_output.status.success(), | 129 | if !install_output.status.success() { |
| 130 | "failed to install gopls. Is `go` installed and in the PATH?" | 130 | log::error!( |
| 131 | ); | 131 | "failed to install gopls via `go install`. stdout: {:?}, stderr: {:?}", |
| 132 | String::from_utf8_lossy(&install_output.stdout), | ||
| 133 | String::from_utf8_lossy(&install_output.stderr) | ||
| 134 | ); | ||
| 135 | |||
| 136 | return Err(anyhow!("failed to install gopls with `go install`. Is `go` installed and in the PATH? Check logs for more information.")); | ||
| 137 | } | ||
| 132 | 138 | ||
| 133 | let installed_binary_path = gobin_dir.join("gopls"); | 139 | let installed_binary_path = gobin_dir.join("gopls"); |
| 134 | let version_output = process::Command::new(&installed_binary_path) | 140 | let version_output = process::Command::new(&installed_binary_path) |