Release Notes: - Improved logging if installing `gopls` fails
Unified · Split
| @@ -125,10 +125,16 @@ impl super::LspAdapter for GoLspAdapter { · 124 unmodified lines | ||
| 125 | 125 | .args(["install", "golang.org/x/tools/gopls@latest"]) |
| 126 | 126 | .output() |
| 127 | 127 | .await?; |
| 128 | − anyhow::ensure!( | |
| 129 | − install_output.status.success(), | |
| 130 | − "failed to install gopls. Is `go` installed and in the PATH?" | |
| 131 | − ); | |
| 128 | + | |
| 129 | + if !install_output.status.success() { | |
| 130 | + log::error!( | |
| 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 | 139 | let installed_binary_path = gobin_dir.join("gopls"); |
| 134 | 140 | let version_output = process::Command::new(&installed_binary_path) |