src/goInstallTools.ts: fix the installation failure message
Instead of `tool` which is an object, provide meaningful tool information.
Previously it would print an error message like
gopls: failed to install [object Object]: Error: Command failed: ....
Change-Id: I14ae19e444447d957bdfe2ef9f1675a51bcbae1a
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/247282
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index 7f2527d..f4a86f5 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -217,6 +217,8 @@
}
args.push(importPath);
+ const toolImportPath = tool.version ? importPath + '@' + tool.version : importPath;
+
let output: string;
let result: string = '';
try {
@@ -240,12 +242,11 @@
const outputFile = path.join(destDir, 'bin', process.platform === 'win32' ? `${tool.name}.exe` : tool.name);
await execFile(goVersion.binaryPath, ['build', '-o', outputFile, importPath], opts);
}
- const toolImportPath = tool.version ? importPath + '@' + tool.version : importPath;
const toolInstallPath = getBinPath(tool.name);
outputChannel.appendLine(`Installing ${toolImportPath} (${toolInstallPath}) SUCCEEDED`);
} catch (e) {
- outputChannel.appendLine(`Installing ${importPath} FAILED`);
- result = `failed to install ${tool}: ${e} ${output} `;
+ outputChannel.appendLine(`Installing ${toolImportPath} FAILED`);
+ result = `failed to install ${tool.name}(${toolImportPath}): ${e} ${output} `;
}
// Delete the temporary installation directory.