src/goDebugConfiguration.ts: invoke pick process for local attach

When the processId is undefined or 0 for a local attach debug config,
we automatically invoke the quick pick to allow the user to choose
which process to attach to.

Additionally, we also throw an error when the user does not select a
process, since the debug configuration will fail.

Updates golang/vscode-go#183

Change-Id: I58c321125c8f96a3219a8ee7639779bea5dca76e
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/288953
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts
index 61fd2f7..a7316f9 100644
--- a/src/goDebugConfiguration.ts
+++ b/src/goDebugConfiguration.ts
@@ -13,6 +13,7 @@
 import { toolExecutionEnvironment } from './goEnv';
 import { promptForMissingTool } from './goInstallTools';
 import { packagePathToGoModPathMap } from './goModules';
+import { pickProcess } from './pickProcess';
 import { getFromGlobalState, updateGlobalState } from './stateUtils';
 import { getBinPath, resolvePath } from './util';
 import { parseEnvFiles } from './utils/envUtils';
@@ -151,11 +152,11 @@
 		return [choice.config];
 	}
 
-	public resolveDebugConfiguration(
+	public async resolveDebugConfiguration(
 		folder: vscode.WorkspaceFolder | undefined,
 		debugConfiguration: vscode.DebugConfiguration,
 		token?: vscode.CancellationToken
-	): vscode.DebugConfiguration {
+	): Promise<vscode.DebugConfiguration> {
 		const activeEditor = vscode.window.activeTextEditor;
 		if (!debugConfiguration || !debugConfiguration.request) {
 			// if 'request' is missing interpret this as a missing launch.json
@@ -259,6 +260,15 @@
 				`Request type of 'attach' with mode 'remote' does not work with 'program' attribute, please use 'cwd' attribute instead.`
 			);
 		}
+
+		if (
+			debugConfiguration.request === 'attach' &&
+			debugConfiguration['mode'] === 'local' &&
+			( !debugConfiguration['processId'] || debugConfiguration['processId'] === 0)
+		) {
+			// The processId is not valid, offer a quickpick menu of all processes.
+			debugConfiguration['processId'] = parseInt(await pickProcess(), 10);
+		}
 		return debugConfiguration;
 	}
 
diff --git a/src/pickProcess.ts b/src/pickProcess.ts
index 2766550..a25a4ce 100644
--- a/src/pickProcess.ts
+++ b/src/pickProcess.ts
@@ -13,8 +13,6 @@
 import { parsePsProcesses, psDarwinCommand, psLinuxCommand } from './utils/psProcessParser';
 import { parseWmicProcesses, wmicCommand } from './utils/wmicProcessParser';
 
-// TODO(suzmue): create a command pickGoProcess to filter
-// to processes that are using go.
 export async function pickProcess(): Promise<string> {
 	const allProcesses = await getAllProcesses();
 	const id = await processPicker(allProcesses);
@@ -37,14 +35,14 @@
 		}
 	);
 	if (!selection) {
-		return '0';
+		return Promise.reject(new Error('No process selected'));
 	}
-	return selection.id;
+	return Promise.resolve(selection.id);
 }
 
-// Taken from:
+// Modified from:
 // https://github.com/microsoft/vscode-python/blob/main/src/client/debugger/extension/attachQuickPick/provider.ts
-
+// - This extension adds a function for identifying the Go processes (getGoProcesses)
 export interface AttachItem extends QuickPickItem {
 	id: string;
 	processName: string;
@@ -60,7 +58,7 @@
 
 async function getGoProcesses(): Promise<AttachItem[]> {
 	const processes = await getAllProcesses();
-	// TODO(suzmue): set the executable path for and darwin.
+	// TODO(suzmue): Set the executable path for darwin.
 	if (process.platform === 'darwin') {
 		return processes;
 	}
diff --git a/src/utils/psProcessParser.ts b/src/utils/psProcessParser.ts
index 714caa3..2140fab 100644
--- a/src/utils/psProcessParser.ts
+++ b/src/utils/psProcessParser.ts
@@ -4,9 +4,9 @@
  * Licensed under the MIT License. See LICENSE in the project root for license information.
  *--------------------------------------------------------*/
 
-// Taken from:
+// Modified from:
 // https://github.com/microsoft/vscode-python/blob/main/src/client/debugger/extension/attachQuickPick/psProcessParser.ts
-
+// - Added the executable path '/proc/{PID}/exe' for linux processes.
 'use strict';
 
 import { AttachItem, ProcessListCommand } from '../pickProcess';
diff --git a/src/utils/wmicProcessParser.ts b/src/utils/wmicProcessParser.ts
index 721b39d..8139f56 100644
--- a/src/utils/wmicProcessParser.ts
+++ b/src/utils/wmicProcessParser.ts
@@ -6,7 +6,7 @@
 
 // Modified from:
 // https://github.com/microsoft/vscode-python/blob/main/src/client/debugger/extension/attachQuickPick/wmicProcessParser.ts.
-// Added arguments to get the ExecutablePath from wmic.
+// - Added arguments to get the ExecutablePath from wmic.
 
 'use strict';
 
diff --git a/test/integration/goDebug.test.ts b/test/integration/goDebug.test.ts
index 58aa1fd..e3b48ee 100644
--- a/test/integration/goDebug.test.ts
+++ b/test/integration/goDebug.test.ts
@@ -350,7 +350,7 @@
 	 * NOTE: For simplicity, this function assumes the breakpoints are in the same file.
 	 */
 	async function setUpRemoteAttach(config: DebugConfiguration, breakpoints: ILocation[] = []): Promise<void> {
-		const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+		const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 		console.log(`Sending initializing request for remote attach setup.`);
 		const initializedResult = await dc.initializeRequest();
 		assert.ok(initializedResult.success);
@@ -461,7 +461,7 @@
 	});
 
 	suite('launch', () => {
-		test('should run program to the end', () => {
+		test('should run program to the end', async () => {
 
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 
@@ -472,7 +472,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence(),
@@ -481,7 +481,7 @@
 			]);
 		});
 
-		test('should stop on entry', () => {
+		test('should stop on entry', async () => {
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 			const config = {
 				name: 'Launch',
@@ -491,7 +491,7 @@
 				program: PROGRAM,
 				stopOnEntry: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence(),
@@ -507,7 +507,7 @@
 			]);
 		});
 
-		test('should debug a file', () => {
+		test('should debug a file', async () => {
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest', 'test.go');
 			const config = {
 				name: 'Launch file',
@@ -517,7 +517,7 @@
 				program: PROGRAM,
 			};
 
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence(),
@@ -526,7 +526,7 @@
 			]);
 		});
 
-		test('should debug a single test', () => {
+		test('should debug a single test', async () => {
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 			const config = {
 				name: 'Launch file',
@@ -540,7 +540,7 @@
 				]
 			};
 
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence(),
@@ -549,7 +549,7 @@
 			]);
 		});
 
-		test('should debug a test package', () => {
+		test('should debug a test package', async () => {
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 			const config = {
 				name: 'Launch file',
@@ -559,7 +559,7 @@
 				program: PROGRAM
 			};
 
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence(),
@@ -568,7 +568,7 @@
 			]);
 		});
 
-		test('invalid flags are passed to dlv but should be caught by dlv', () => {
+		test('invalid flags are passed to dlv but should be caught by dlv', async () => {
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 			const config = {
 				name: 'Launch',
@@ -578,7 +578,7 @@
 				program: PROGRAM,
 				dlvFlags: ['--invalid']
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 			return Promise.all([
 				dc.assertOutput('stderr', 'Error: unknown flag: --invalid\n', 5000),
 				dc.waitForEvent('terminated'),
@@ -602,7 +602,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence().then(() => {
@@ -627,7 +627,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -639,7 +639,7 @@
 			assert.ok(response.success);
 		});
 
-		test('user-specified --listen flag should be ignored', () => {
+		test('user-specified --listen flag should be ignored', async () => {
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 			const config = {
 				name: 'Launch',
@@ -649,7 +649,7 @@
 				program: PROGRAM,
 				dlvFlags: ['--listen=127.0.0.1:80'],
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.configurationSequence(),
@@ -674,7 +674,7 @@
 				program: PROGRAM,
 				cwd: WD,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 
@@ -694,7 +694,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 
@@ -715,7 +715,7 @@
 				program: PROGRAM,
 				cwd: WD,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 
@@ -735,14 +735,14 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 
 			await assertVariableValue('strdat', '"Goodbye, World."');
 		});
 
-		test('should run program with cwd set (noDebug)', () => {
+		test('should run program with cwd set (noDebug)', async () => {
 			const WD = path.join(DATA_ROOT, 'cwdTest');
 			const PROGRAM = path.join(WD, 'cwdTest');
 
@@ -755,7 +755,7 @@
 				cwd: WD,
 				noDebug: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.launch(debugConfig),
@@ -765,7 +765,7 @@
 			]);
 		});
 
-		test('should run program without cwd set (noDebug)', () => {
+		test('should run program without cwd set (noDebug)', async () => {
 			const WD = path.join(DATA_ROOT, 'cwdTest');
 			const PROGRAM = path.join(WD, 'cwdTest');
 
@@ -777,7 +777,7 @@
 				program: PROGRAM,
 				noDebug: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.launch(debugConfig),
@@ -787,7 +787,7 @@
 			]);
 		});
 
-		test('should run file program with cwd set (noDebug)', () => {
+		test('should run file program with cwd set (noDebug)', async () => {
 			const WD = path.join(DATA_ROOT, 'cwdTest');
 			const PROGRAM = path.join(WD, 'cwdTest', 'main.go');
 
@@ -800,7 +800,7 @@
 				cwd: WD,
 				noDebug: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.launch(debugConfig),
@@ -810,7 +810,7 @@
 			]);
 		});
 
-		test('should run file program without cwd set (noDebug)', () => {
+		test('should run file program without cwd set (noDebug)', async () => {
 			const WD = path.join(DATA_ROOT, 'cwdTest');
 			const PROGRAM = path.join(WD, 'cwdTest', 'main.go');
 
@@ -822,7 +822,7 @@
 				program: PROGRAM,
 				noDebug: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 				dc.launch(debugConfig),
@@ -841,7 +841,7 @@
 		setup(async () => {
 			server = await getPort();
 			remoteAttachConfig.port = await getPort();
-			debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
+			debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
 		});
 
 		teardown(async () => {
@@ -886,10 +886,10 @@
 		setup(async () => {
 			server = await getPort();
 			remoteAttachConfig.port = await getPort();
-			remoteAttachDebugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
+			remoteAttachDebugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
 		});
 
-		test('should stop on a breakpoint', () => {
+		test('should stop on a breakpoint', async () => {
 
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 
@@ -903,12 +903,12 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 		});
 
-		test('should stop on a breakpoint in test file', () => {
+		test('should stop on a breakpoint in test file', async () => {
 
 			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
 
@@ -922,7 +922,7 @@
 				mode: 'test',
 				program: PROGRAM
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 		});
@@ -1005,7 +1005,7 @@
 				mode: 'auto',
 				program: PROGRAM
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1039,7 +1039,7 @@
 				mode: 'auto',
 				program: PROGRAM
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, setupBreakpoint);
 
@@ -1084,7 +1084,7 @@
 	});
 
 	suite('conditionalBreakpoints', () => {
-		test('should stop on conditional breakpoint', () => {
+		test('should stop on conditional breakpoint', async () => {
 
 			const PROGRAM = path.join(DATA_ROOT, 'condbp');
 			const FILE = path.join(DATA_ROOT, 'condbp', 'condbp.go');
@@ -1098,7 +1098,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 			return Promise.all([
 
 				dc.waitForEvent('initialized').then(() => {
@@ -1135,7 +1135,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return dc.hitBreakpoint(debugConfig, location).then(() =>
 				// The program is stopped at the breakpoint, check to make sure 'i == 0'.
@@ -1158,7 +1158,7 @@
 			);
 		});
 
-		test('should remove breakpoint condition', () => {
+		test('should remove breakpoint condition', async () => {
 
 			const PROGRAM = path.join(DATA_ROOT, 'condbp');
 			const FILE = path.join(DATA_ROOT, 'condbp', 'condbp.go');
@@ -1172,7 +1172,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 			return Promise.all([
 
 				dc.waitForEvent('initialized').then(() => {
@@ -1213,7 +1213,7 @@
 
 	suite('panicBreakpoints', () => {
 
-		test('should stop on panic', () => {
+		test('should stop on panic', async () => {
 
 			const PROGRAM_WITH_EXCEPTION = path.join(DATA_ROOT, 'panic');
 
@@ -1224,7 +1224,7 @@
 				mode: 'auto',
 				program: PROGRAM_WITH_EXCEPTION,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			return Promise.all([
 
@@ -1253,7 +1253,7 @@
 			remoteAttachConfig.port = await getPort();
 			const remoteProgram = await setUpRemoteProgram(remoteAttachConfig.port, server);
 
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
 
 			// Setup attach.
 			await setUpRemoteAttach(debugConfig);
@@ -1293,7 +1293,7 @@
 				program: PROGRAM,
 				stopOnEntry: false
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1317,7 +1317,7 @@
 				program: PROGRAM,
 				stopOnEntry: false
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1343,7 +1343,7 @@
 				program: PROGRAM,
 				stopOnEntry: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1373,7 +1373,7 @@
 				program: PROGRAM,
 				stopOnEntry: false
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, location);
 
@@ -1396,7 +1396,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1424,7 +1424,7 @@
 				mode: 'auto',
 				program: PROGRAM,
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 
@@ -1445,7 +1445,7 @@
 				program: PROGRAM,
 				stopOnEntry: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1469,7 +1469,7 @@
 				program: PROGRAM,
 				stopOnEntry: true
 			};
-			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 			await Promise.all([
 				dc.configurationSequence(),
@@ -1555,7 +1555,7 @@
 						}
 					]
 				};
-				const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+				const debugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, config);
 
 				return dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 			});
@@ -1569,7 +1569,7 @@
 			setup(async () => {
 				server = await getPort();
 				remoteAttachConfig.port = await getPort();
-				remoteAttachDebugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
+				remoteAttachDebugConfig = await debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
 			});
 
 			suiteSetup(() => {
diff --git a/test/integration/goDebugConfiguration.test.ts b/test/integration/goDebugConfiguration.test.ts
index 03662ab..17b761d 100644
--- a/test/integration/goDebugConfiguration.test.ts
+++ b/test/integration/goDebugConfiguration.test.ts
@@ -144,7 +144,7 @@
 	teardown(() => sinon.restore());
 
 	suite(`merge 'go' config from settings.json`, () => {
-		test('go flags config does not affect debug config', () => {
+		test('go flags config does not affect debug config', async () => {
 			// This tests that the testFlags and GOOS and GOARCH set
 			// in settings.json do not affect the resolved debug configuration.
 			// When this expected behavior changes, this test can be updated.
@@ -158,7 +158,7 @@
 				program: '${fileDirname}',
 			};
 
-			const emptyResult = debugConfigProvider.resolveDebugConfiguration(undefined, cfg1);
+			const emptyResult = await debugConfigProvider.resolveDebugConfiguration(undefined, cfg1);
 			const goConfig = Object.create(getGoConfig(), {
 				testFlags: {value: '-tags=myTagTest'},
 				buildFlags: {value: '-tags=myTagBuild'},
@@ -177,7 +177,7 @@
 				program: '${fileDirname}',
 			};
 
-			const filledResult = debugConfigProvider.resolveDebugConfiguration(undefined, cfg2);
+			const filledResult = await debugConfigProvider.resolveDebugConfiguration(undefined, cfg2);
 
 			assert.strictEqual(filledResult.name, emptyResult.name);
 			assert.strictEqual(filledResult.type, emptyResult.type);
@@ -189,7 +189,7 @@
 			assert.strictEqual(filledResult.showGlobalVariables, emptyResult.showGlobalVariables);
 		});
 
-		test('delve config in settings.json is added to debug config', () => {
+		test('delve config in settings.json is added to debug config', async () => {
 			// This tests that the testFlags and GOOS and GOARCH set
 			// in settings.json do not affect the resolved debug configuration.
 			// When this expected behavior changes, this test can be updated.
@@ -219,7 +219,7 @@
 				program: '${fileDirname}',
 			};
 
-			const result = debugConfigProvider.resolveDebugConfiguration(undefined, cfg);
+			const result = await debugConfigProvider.resolveDebugConfiguration(undefined, cfg);
 			assert.strictEqual(result.apiVersion, 1);
 			assert.strictEqual(result.showGlobalVariables, true);
 			const dlvLoadConfig = result.dlvLoadConfig;
@@ -230,7 +230,7 @@
 			assert.strictEqual(dlvLoadConfig.maxStructFields, 5);
 		});
 
-		test('delve config in settings.json is overriden by launch.json', () => {
+		test('delve config in settings.json is overriden by launch.json', async () => {
 			// This tests that the testFlags and GOOS and GOARCH set
 			// in settings.json do not affect the resolved debug configuration.
 			// When this expected behavior changes, this test can be updated.
@@ -269,7 +269,7 @@
 				},
 			};
 
-			const result = debugConfigProvider.resolveDebugConfiguration(undefined, cfg);
+			const result = await debugConfigProvider.resolveDebugConfiguration(undefined, cfg);
 			assert.strictEqual(result.apiVersion, 2);
 			assert.strictEqual(result.showGlobalVariables, false);
 			const dlvLoadConfig = result.dlvLoadConfig;