From 6b5bd55e173d96f7020a7b31dea21f7816b0c5c6 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Mon, 16 Dec 2019 17:04:30 -0500 Subject: [PATCH 1/2] delete and recreate go.mod instead of running go mod tidy --- src/goInstallTools.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index ddfec933b..01345ea75 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -134,10 +134,6 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise, tool: Tool) => { // Disable modules for tools which are installed with the "..." wildcard. // TODO: ... will be supported in Go 1.13, so enable these tools to use modules then. @@ -148,16 +144,19 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise new Promise((resolve, reject) => { const opts = { env: envForTools, cwd: toolsTmpDir, }; const callback = (err: Error, stdout: string, stderr: string) => { - // Make sure to run `go mod tidy` between tool installations. - // This avoids us having to create a fresh go.mod file for each tool. - if (!modulesOffForTool) { - cp.execFileSync(goRuntimePath, ['mod', 'tidy'], opts); + // Make sure to delete the temporary go.mod file, if it exists. + if (fs.existsSync(tmpGoModFile)) { + fs.unlinkSync(tmpGoModFile); } if (err) { outputChannel.appendLine('Installing ' + getImportPath(tool, goVersion) + ' FAILED'); From 09109888643c537c92f8caa185e09a089de305bf Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Mon, 23 Dec 2019 15:30:48 -0500 Subject: [PATCH 2/2] only write file when modules are on --- src/goInstallTools.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index 01345ea75..216ea1047 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -138,16 +138,16 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise new Promise((resolve, reject) => { const opts = { env: envForTools, @@ -155,7 +155,7 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise { // Make sure to delete the temporary go.mod file, if it exists. - if (fs.existsSync(tmpGoModFile)) { + if (tmpGoModFile && fs.existsSync(tmpGoModFile)) { fs.unlinkSync(tmpGoModFile); } if (err) {