Skip to content

Commit

Permalink
extension/src/goMain: skip vscgo installation on windows
Browse files Browse the repository at this point in the history
And, pass `-trimpath` when building it so the executable
file hash is stable.

And increase the vscgo test timeout.

Fixes #3182

Change-Id: Ib86bf07ddc4a89849bb778b2621268b334f3a80a
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/565679
Reviewed-by: Peter Weinberger <pjw@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Commit-Queue: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
  • Loading branch information
hyangah committed Feb 21, 2024
1 parent 9480a16 commit 0b3fabc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
7 changes: 7 additions & 0 deletions extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v0.41.1 - 22 Feb, 2024

This release is a point release to skip `vscgo` installation on Windows
([Issue 3182](https://github.com/golang/vscode-go/issues/3182)).
For a detailed list of changes, refer to the complete
[commit history](https://github.com/golang/vscode-go/compare/v0.41.0...v0.41.1).

## v0.41.0 - 14 Feb, 2024

This release introduces significant updates to the extension's UI.
Expand Down
2 changes: 1 addition & 1 deletion extension/src/goInstallTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ export async function maybeInstallVSCGO(
: `@v${extensionVersion}`;
// build from source acquired from the module proxy if this is a non-preview version.
try {
const args = ['install', `${importPath}${version}`];
const args = ['install', '-trimpath', `${importPath}${version}`];
console.log(`installing vscgo: ${args.join(' ')}`);
await execFile(getBinPath('go'), args, { cwd, env });
return progPath;
Expand Down
21 changes: 12 additions & 9 deletions extension/src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,18 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<ExtensionA
await updateGoVarsFromConfig(goCtx);

// for testing or development mode, always rebuild vscgo.
maybeInstallVSCGO(
ctx.extensionMode,
ctx.extension.id,
extensionInfo.version || '',
ctx.extensionPath,
extensionInfo.isPreview
)
.then((path) => telemetryReporter.setTool(path))
.catch((reason) => console.error(reason));
if (process.platform !== 'win32') {
// skip windows until Windows Defender issue reported in golang/vscode-go#3182 can be addressed
maybeInstallVSCGO(
ctx.extensionMode,
ctx.extension.id,
extensionInfo.version || '',
ctx.extensionPath,
extensionInfo.isPreview
)
.then((path) => telemetryReporter.setTool(path))
.catch((reason) => console.error(reason));
}

const registerCommand = commands.createRegisterCommand(ctx, goCtx);
registerCommand('go.languageserver.restart', commands.startLanguageServer);
Expand Down
4 changes: 1 addition & 3 deletions extension/test/gopls/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ function testTelemetryPrompt(tc: testCase, wantPrompt: boolean) {
}

describe('# telemetry reporter using vscgo', async function () {
if (os.platform() === 'win32') {
this.timeout(10000); // go install is slow on windows builder.
}
this.timeout(10000); // go install can be slow.
// installVSCGO expects
// {extensionPath}/vscgo: vscgo source code for testing.
// {extensionPath}/bin: where compiled vscgo will be stored.
Expand Down

0 comments on commit 0b3fabc

Please sign in to comment.