go: better logging if go install gopls
fails (#8060)
Release Notes: - Improved logging if installing `gopls` fails
This commit is contained in:
parent
0d2ad67b27
commit
80db468720
1 changed files with 10 additions and 4 deletions
|
@ -125,10 +125,16 @@ impl super::LspAdapter for GoLspAdapter {
|
||||||
.args(["install", "golang.org/x/tools/gopls@latest"])
|
.args(["install", "golang.org/x/tools/gopls@latest"])
|
||||||
.output()
|
.output()
|
||||||
.await?;
|
.await?;
|
||||||
anyhow::ensure!(
|
|
||||||
install_output.status.success(),
|
if !install_output.status.success() {
|
||||||
"failed to install gopls. Is `go` installed and in the PATH?"
|
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 installed_binary_path = gobin_dir.join("gopls");
|
||||||
let version_output = process::Command::new(&installed_binary_path)
|
let version_output = process::Command::new(&installed_binary_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue