src/debugAdapter: add dlvFlags to accept arbitrary delve flags

Added the same to src/debugAdapter2. We don't do any flag validation
- that will be done by dlv. We place the user-specified flags before
the flags internally set up, so, when users specify flags that are used
internally (e.g. --listen) or that are configured through the debug
configuration properties (e.g. --log-output) as well, the flag values
internally set up can be picked up unless dlv complains about the
duplicated flags.

This flag property and other properties related to dlv flags are
currently passed as part of launch request args because the legacy DA
launches the delve process upon receiving the launch request. However,
I am not sure if that's still true when we switch to the delve DAP mode
and we can launch the delve DAP directly from the extension. For now,
I added dlvFlags to the delve DAP mode thin adapter too (like other
flag-related properties).

Fixes golang/vscode-go#810
Updates golang/vscode-go#978

Change-Id: Iaab6097d3357ccafc274cb0a4fc970f2b6945b66
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/280697
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Polina Sokolova <polina@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
diff --git a/docs/debugging.md b/docs/debugging.md
index 5ae9ddb..e41eda1 100644
--- a/docs/debugging.md
+++ b/docs/debugging.md
@@ -107,9 +107,10 @@
 env        | Environment variables to use when debugging. Use the format: `{ "NAME": "VALUE" }`. Not applicable to `attach` requests.
 envFile    | Absolute path to a file containing environment variable definitions. The environment variables passed in via the `env` property override the ones in this file.
 args       | Array of command-line arguments to pass to the program being debugged.
-showLog    | If `true`, Delve logs will be printed in the Debug Console panel.
-logOutput  | Comma-separated list of Delve components (`debugger`, `gdbwire`, `lldbout`, `debuglineerr`, `rpc`) that should produce debug output when `showLog` is `true`.
-buildFlags | Build flags to pass to the Go compiler.
+showLog    | If `true`, Delve logs will be printed in the Debug Console panel. This corresponds to `dlv`'s `--log` flag.
+logOutput  | Comma-separated list of Delve components (`debugger`, `gdbwire`, `lldbout`, `debuglineerr`, `rpc`) that should produce debug output when `showLog` is `true`. This corresponds to `dlv`'s `--log-output` flag.
+buildFlags | Build flags to pass to the Go compiler. This corresponds to `dlv`'s `--build-flags` flag.
+dlvFlags   | Extra flags passed to `dlv`. See `dlv help` for the full list of supported flags. This is useful when users need to pass less commonly used or new flags such as `--only-same-user`, `--check-go-version`. Note that some flags such as `--log-output`, `--log`, `--init`, `--api-version` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.
 remotePath | If remote debugging (`mode`: `remote`), this should be the absolute path to the package being debugged on the remote machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant. Becomes the first mapping in substitutePath.
 substitutePath | An array of mappings from an absolute local path to an absolute remote path that is used by the debuggee. The debug adapter will replace the local path with the remote path in all of the calls. The mappings are applied in order, and the first matching mapping is used. This can be used to map files that have moved since the program was built, different remote paths, and symlinked files or directories. This is intended to be equivalent to the [substitute-path]((https://github.com/go-delve/delve/tree/master/Documentation/cli#config)(https://github.com/go-delve/delve/tree/master/Documentation/cli#config)) configuration, and will eventually configure substitute-path in Delve directly.
 cwd | The working directory to be used in running the program. If remote debugging (`mode`: `remote`), this should be the absolute path to the working directory being debugged on the local machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant.
diff --git a/package.json b/package.json
index c2f324a..ca95f2c 100644
--- a/package.json
+++ b/package.json
@@ -515,7 +515,7 @@
               },
               "showLog": {
                 "type": "boolean",
-                "description": "Show log output from the delve debugger.",
+                "description": "Show log output from the delve debugger. Maps to dlv's `--log` flag.",
                 "default": false
               },
               "cwd": {
@@ -550,14 +550,22 @@
               },
               "buildFlags": {
                 "type": "string",
-                "description": "Build flags, to be passed to the Go compiler.",
+                "description": "Build flags, to be passed to the Go compiler. Maps to dlv's `--build-flags` flag.",
                 "default": ""
               },
               "init": {
                 "type": "string",
-                "description": "Init file, executed by the terminal client.",
+                "description": "Init file, executed by the terminal client. Maps to dlv's `--init` flag.",
                 "default": ""
               },
+              "dlvFlags": {
+                "type": "array",
+                "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--init`, `--api-version` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.",
+                "items": {
+                  "type": "string"
+                },
+                "default": []
+              },
               "remotePath": {
                 "type": "string",
                 "description": "Absolute path to the file being debugged on the remote machine in case of remote debugging. If specified, becomes the first entry in substitutePath.",
@@ -617,7 +625,7 @@
                   "debuglineerr",
                   "rpc"
                 ],
-                "description": "Comma separated list of components that should produce debug output.",
+                "description": "Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag.",
                 "default": "debugger"
               },
               "dlvLoadConfig": {
@@ -664,7 +672,7 @@
                   1,
                   2
                 ],
-                "description": "Delve Api Version to use. Default value is 2.",
+                "description": "Delve Api Version to use. Default value is 2. Maps to dlv's `--api-version` flag.",
                 "default": 2
               },
               "stackTraceDepth": {
@@ -691,12 +699,20 @@
                   "local",
                   "remote"
                 ],
-                "description": "Indicates local or remote debugging.  Local maps to the dlv 'attach' command, remote maps to 'connect'.",
+                "description": "Indicates local or remote debugging. Local maps to the dlv 'attach' command, remote maps to 'connect'.",
                 "default": "local"
               },
+              "dlvFlags": {
+                "type": "array",
+                "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output` and `--log` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.",
+                "items": {
+                  "type": "string"
+                },
+                "default": []
+              },
               "showLog": {
                 "type": "boolean",
-                "description": "Show log output from the delve debugger.",
+                "description": "Show log output from the delve debugger. Maps to dlv's `--log` flag.",
                 "default": false
               },
               "cwd": {
@@ -767,7 +783,7 @@
                   "debuglineerr",
                   "rpc"
                 ],
-                "description": "Comma separated list of components that should produce debug output.",
+                "description": "Comma separated list of components that should produce debug output. Maps to `--log-output` flag.",
                 "default": "debugger"
               },
               "dlvLoadConfig": {
@@ -947,7 +963,7 @@
               },
               "showLog": {
                 "type": "boolean",
-                "description": "Show log output from the delve debugger.",
+                "description": "Show log output from the delve debugger. Maps to dlv's `--log` flag.",
                 "default": false
               },
               "cwd": {
@@ -970,6 +986,14 @@
                 "description": "Init file, executed by the terminal client.",
                 "default": ""
               },
+              "dlvFlags": {
+                "type": "array",
+                "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output` and `--log` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.",
+                "items": {
+                  "type": "string"
+                },
+                "default": []
+              },
               "remotePath": {
                 "type": "string",
                 "description": "Absolute path to the file being debugged on the remote machine in case of remote debugging.",
@@ -1029,7 +1053,7 @@
                   "debuglineerr",
                   "dap"
                 ],
-                "description": "Comma separated list of components that should produce debug output.",
+                "description": "Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag.",
                 "default": "debugger"
               },
               "dlvLoadConfig": {
@@ -1097,9 +1121,17 @@
                 "description": "Indicates local or remote debugging.  Local maps to the dlv 'attach' command, remote maps to 'connect'.",
                 "default": "local"
               },
+              "dlvFlags": {
+                "type": "array",
+                "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output` and `--log` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.",
+                "items": {
+                  "type": "string"
+                },
+                "default": []
+              },
               "showLog": {
                 "type": "boolean",
-                "description": "Show log output from the delve debugger.",
+                "description": "Show log output from the delve debugger. Maps to dlv's `--log` flag.",
                 "default": false
               },
               "cwd": {
@@ -1151,7 +1183,7 @@
                   "dap",
                   "rpc"
                 ],
-                "description": "Comma separated list of components that should produce debug output.",
+                "description": "Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag.",
                 "default": "debugger"
               },
               "dlvLoadConfig": {
diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts
index e91b9e1..17cdaad 100644
--- a/src/debugAdapter/goDebug.ts
+++ b/src/debugAdapter/goDebug.ts
@@ -263,6 +263,7 @@
 	[key: string]: any;
 	program: string;
 	stopOnEntry?: boolean;
+	dlvFlags?: string[];
 	args?: string[];
 	showLog?: boolean;
 	logOutput?: string;
@@ -300,6 +301,7 @@
 	request: 'attach';
 	processId?: number;
 	stopOnEntry?: boolean;
+	dlvFlags?: string[];
 	showLog?: boolean;
 	logOutput?: string;
 	cwd?: string;
@@ -613,6 +615,11 @@
 				} else if (currentGOWorkspace && !launchArgs.packagePathToGoModPathMap[dirname]) {
 					dlvArgs.push(dirname.substr(currentGOWorkspace.length + 1));
 				}
+				// add user-specified dlv flags first. When duplicate flags are specified,
+				// dlv doesn't mind but accepts the last flag value.
+				if (launchArgs.dlvFlags && launchArgs.dlvFlags.length > 0) {
+					dlvArgs.push(...launchArgs.dlvFlags);
+				}
 				dlvArgs.push('--headless=true', `--listen=${launchArgs.host}:${launchArgs.port}`);
 				if (!this.isApiV1) {
 					dlvArgs.push('--api-version=2');
@@ -655,6 +662,11 @@
 				}
 
 				dlvArgs.push('attach', `${launchArgs.processId}`);
+				// add user-specified dlv flags first. When duplicate flags are specified,
+				// dlv doesn't mind but accepts the last flag value.
+				if (launchArgs.dlvFlags && launchArgs.dlvFlags.length > 0) {
+					dlvArgs.push(...launchArgs.dlvFlags);
+				}
 				dlvArgs.push('--headless=true', '--listen=' + launchArgs.host + ':' + launchArgs.port.toString());
 				if (!this.isApiV1) {
 					dlvArgs.push('--api-version=2');
diff --git a/src/debugAdapter2/goDlvDebug.ts b/src/debugAdapter2/goDlvDebug.ts
index c397050..d8ee451 100644
--- a/src/debugAdapter2/goDlvDebug.ts
+++ b/src/debugAdapter2/goDlvDebug.ts
@@ -44,6 +44,7 @@
 	[key: string]: any;
 	program: string;
 	stopOnEntry?: boolean;
+	dlvFlags?: string[];
 	args?: string[];
 	showLog?: boolean;
 	logOutput?: string;
@@ -674,6 +675,11 @@
 
 		const dlvArgs = new Array<string>();
 		dlvArgs.push('dap');
+		// add user-specified dlv flags first. When duplicate flags are specified,
+		// dlv doesn't mind but accepts the last flag value.
+		if (launchArgs.dlvFlags && launchArgs.dlvFlags.length > 0) {
+			dlvArgs.push(...launchArgs.dlvFlags);
+		}
 		dlvArgs.push(`--listen=${launchArgs.host}:${launchArgs.port}`);
 		if (launchArgs.showLog) {
 			dlvArgs.push('--log=' + launchArgs.showLog.toString());
@@ -681,7 +687,6 @@
 		if (launchArgs.logOutput) {
 			dlvArgs.push('--log-output=' + launchArgs.logOutput);
 		}
-
 		log(`Running: ${dlvPath} ${dlvArgs.join(' ')}`);
 
 		const dir = parseProgramArgSync(launchArgs).dirname;
diff --git a/test/integration/goDebug.test.ts b/test/integration/goDebug.test.ts
index e52bf1f..87f19cd 100644
--- a/test/integration/goDebug.test.ts
+++ b/test/integration/goDebug.test.ts
@@ -303,7 +303,7 @@
 	let dc: DebugClient;
 
 	setup(() => {
-		dc = new DebugClient('node', path.join(PROJECT_ROOT, DEBUG_ADAPTER), 'go');
+		dc = new DebugClient('node', path.join(PROJECT_ROOT, DEBUG_ADAPTER), 'go', undefined, true);
 
 		// Launching delve may take longer than the default timeout of 5000.
 		dc.defaultTimeout = 20_000;
@@ -323,8 +323,8 @@
 	 * running vs stopped/killed.
 	 */
 	async function setUpRemoteProgram(
-			dlvPort: number, serverPort: number,
-			acceptMultiClient = true, continueOnStart = true): Promise<cp.ChildProcess> {
+		dlvPort: number, serverPort: number,
+		acceptMultiClient = true, continueOnStart = true): Promise<cp.ChildProcess> {
 		const serverFolder = path.join(DATA_ROOT, 'helloWorldServer');
 		const toolPath = getBinPath('dlv');
 		const args = ['debug', '--api-version=2', '--headless', `--listen=127.0.0.1:${dlvPort}`];
@@ -335,7 +335,7 @@
 			args.push('--continue');
 		}
 		const childProcess = cp.spawn(toolPath, args,
-			{cwd: serverFolder,  env: { PORT: `${serverPort}`, ...process.env}});
+			{ cwd: serverFolder, env: { PORT: `${serverPort}`, ...process.env } });
 
 		// Give dlv a few seconds to start.
 		await new Promise((resolve) => setTimeout(resolve, 10_000));
@@ -369,7 +369,7 @@
 
 		if (breakpoints.length) {
 			console.log(`Sending set breakpoints request for remote attach setup.`);
-			const breakpointsResult = await dc.setBreakpointsRequest({source: {path: breakpoints[0].path}, breakpoints});
+			const breakpointsResult = await dc.setBreakpointsRequest({ source: { path: breakpoints[0].path }, breakpoints });
 			assert.ok(breakpointsResult.success && breakpointsResult.body.breakpoints.length === breakpoints.length);
 			// Verify that there are no non-verified breakpoints.
 			breakpointsResult.body.breakpoints.forEach((breakpoint) => {
@@ -567,6 +567,49 @@
 				dc.waitForEvent('terminated')
 			]);
 		});
+
+		test('invalid flags are passed to dlv but should be caught by dlv', () => {
+			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
+			const config = {
+				name: 'Launch',
+				type: 'go',
+				request: 'launch',
+				mode: 'auto',
+				program: PROGRAM,
+				dlvFlags: ['--invalid']
+			};
+			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+			return Promise.all([
+				dc.assertOutput('stderr', 'Error: unknown flag: --invalid\n', 5000),
+				dc.waitForEvent('terminated'),
+				dc.initializeRequest().then((response) => {
+					// The current debug adapter does not respond to launch request but,
+					// instead, sends error messages and TerminatedEvent as delve is closed.
+					// The promise from dc.launchRequest resolves when the launch response
+					// is received, so the promise will never get resolved.
+					dc.launchRequest(debugConfig as any);
+				})
+			]);
+		});
+
+		test('user-specified --listen flag should be ignored', () => {
+			const PROGRAM = path.join(DATA_ROOT, 'baseTest');
+			const config = {
+				name: 'Launch',
+				type: 'go',
+				request: 'launch',
+				mode: 'auto',
+				program: PROGRAM,
+				dlvFlags: ['--listen=127.0.0.1:80'],
+			};
+			const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);
+
+			return Promise.all([
+				dc.configurationSequence(),
+				dc.launch(debugConfig),
+				dc.waitForEvent('terminated')
+			]);
+		});
 	});
 
 	suite('set current working directory', () => {
@@ -755,7 +798,7 @@
 		});
 
 		teardown(async () => {
-			await dc.disconnectRequest({restart: false});
+			await dc.disconnectRequest({ restart: false });
 			await killProcessTree(childProcess);
 			// Wait 2 seconds for the process to be killed.
 			await new Promise((resolve) => setTimeout(resolve, 2_000));
@@ -763,31 +806,31 @@
 
 		test('can connect and initialize using external dlv --headless --accept-multiclient=true --continue=true',
 			async () => {
-			childProcess = await setUpRemoteProgram(remoteAttachConfig.port, server, true, true);
+				childProcess = await setUpRemoteProgram(remoteAttachConfig.port, server, true, true);
 
-			await setUpRemoteAttach(debugConfig);
-		});
+				await setUpRemoteAttach(debugConfig);
+			});
 
 		test('can connect and initialize using external dlv --headless --accept-multiclient=false --continue=false',
 			async () => {
-			childProcess = await setUpRemoteProgram(remoteAttachConfig.port, server, false, false);
+				childProcess = await setUpRemoteProgram(remoteAttachConfig.port, server, false, false);
 
-			await setUpRemoteAttach(debugConfig);
-		});
+				await setUpRemoteAttach(debugConfig);
+			});
 
 		test('can connect and initialize using external dlv --headless --accept-multiclient=true --continue=false',
 			async () => {
-			childProcess = await setUpRemoteProgram(remoteAttachConfig.port, server, true, false);
+				childProcess = await setUpRemoteProgram(remoteAttachConfig.port, server, true, false);
 
-			await setUpRemoteAttach(debugConfig);
-		});
+				await setUpRemoteAttach(debugConfig);
+			});
 	});
 
 	// The file paths returned from delve use '/' not the native path
 	// separator, so we can replace any instances of '\' with '/', which
 	// allows the hitBreakpoint check to match.
-	const getBreakpointLocation =  (FILE: string, LINE: number, useBackSlash = true) => {
-		return {path: useBackSlash ? FILE.replace(/\\/g, '/') : FILE, line: LINE };
+	const getBreakpointLocation = (FILE: string, LINE: number, useBackSlash = true) => {
+		return { path: useBackSlash ? FILE.replace(/\\/g, '/') : FILE, line: LINE };
 	};
 
 	suite('setBreakpoints', () => {
@@ -852,7 +895,7 @@
 				() => http.get(`http://localhost:${server}`).on('error', (data) => console.log(data)),
 				breakpointLocation);
 
-			await dc.disconnectRequest({restart: false});
+			await dc.disconnectRequest({ restart: false });
 			await killProcessTree(remoteProgram);
 			await new Promise((resolve) => setTimeout(resolve, 2_000));
 		});
@@ -868,7 +911,7 @@
 			// Now sets a breakpoint.
 			const breakpointLocation = getBreakpointLocation(FILE, BREAKPOINT_LINE);
 			const breakpointsResult = await dc.setBreakpointsRequest(
-				{source: {path: breakpointLocation.path}, breakpoints: [breakpointLocation]});
+				{ source: { path: breakpointLocation.path }, breakpoints: [breakpointLocation] });
 			assert.ok(breakpointsResult.success && breakpointsResult.body.breakpoints[0].verified);
 
 			// Calls the helloworld server to make the breakpoint hit.
@@ -876,7 +919,7 @@
 				() => http.get(`http://localhost:${server}`).on('error', (data) => console.log(data)),
 				breakpointLocation);
 
-			await dc.disconnectRequest({restart: false});
+			await dc.disconnectRequest({ restart: false });
 			await killProcessTree(remoteProgram);
 			await new Promise((resolve) => setTimeout(resolve, 2_000));
 		});
@@ -896,7 +939,7 @@
 				() => http.get(`http://localhost:${server}`).on('error', (data) => console.log(data)),
 				breakpointLocation);
 
-			await dc.disconnectRequest({restart: false});
+			await dc.disconnectRequest({ restart: false });
 			await killProcessTree(remoteProgram);
 			await new Promise((resolve) => setTimeout(resolve, 2_000));
 		});
@@ -924,8 +967,8 @@
 
 			return Promise.all([
 				dc.setBreakpointsRequest({
-					lines: [ helloLocation.line ],
-					breakpoints: [ { line: helloLocation.line, column: 0 } ],
+					lines: [helloLocation.line],
+					breakpoints: [{ line: helloLocation.line, column: 0 }],
 					source: { path: helloLocation.path }
 				}),
 				dc.assertStoppedLocation('breakpoint', helloLocation)
@@ -962,8 +1005,8 @@
 			// stopped on the next line.
 			await Promise.all([
 				dc.setBreakpointsRequest({
-					lines: [ onNextBreakpoint.line ],
-					breakpoints: [ { line: onNextBreakpoint.line, column: 0 } ],
+					lines: [onNextBreakpoint.line],
+					breakpoints: [{ line: onNextBreakpoint.line, column: 0 }],
 					source: { path: onNextBreakpoint.path }
 				}),
 				dc.assertStoppedLocation('next cancelled', {})
@@ -973,21 +1016,21 @@
 			// make sure the breakpoint set while the program was nexting
 			// is succesfully hit.
 			await Promise.all([
-				dc.continueRequest({threadId: 1}),
+				dc.continueRequest({ threadId: 1 }),
 				dc.assertStoppedLocation('breakpoint', onNextBreakpoint)
 			]);
 		}
 
 		test('should set breakpoints during next', async () => {
 			setBreakpointsDuringStep(async () => {
-				const nextResponse = await dc.nextRequest({threadId: 1});
+				const nextResponse = await dc.nextRequest({ threadId: 1 });
 				assert.ok(nextResponse.success);
 			});
 		});
 
 		test('should set breakpoints during step out', async () => {
 			setBreakpointsDuringStep(async () => {
-				const stepOutResponse = await dc.stepOutRequest({threadId: 1});
+				const stepOutResponse = await dc.stepOutRequest({ threadId: 1 });
 				assert.ok(stepOutResponse.success);
 			});
 		});
@@ -1211,7 +1254,7 @@
 			]);
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated')
 			]);
 		});
@@ -1235,8 +1278,8 @@
 			]);
 
 			await Promise.all([
-				dc.disconnectRequest({restart: false}).then(() =>
-					dc.disconnectRequest({restart: false})
+				dc.disconnectRequest({ restart: false }).then(() =>
+					dc.disconnectRequest({ restart: false })
 				),
 				dc.waitForEvent('terminated')
 			]);
@@ -1264,7 +1307,7 @@
 			assert.ok(continueResponse.success);
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated')
 			]);
 		});
@@ -1291,7 +1334,7 @@
 			assert.ok(nextResponse.success);
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated')
 			]);
 		});
@@ -1313,11 +1356,11 @@
 				dc.launch(debugConfig)
 			]);
 
-			const pauseResponse = await dc.pauseRequest({threadId: 1});
+			const pauseResponse = await dc.pauseRequest({ threadId: 1 });
 			assert.ok(pauseResponse.success);
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated'),
 			]);
 		});
@@ -1339,7 +1382,7 @@
 			await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated')
 			]);
 		});
@@ -1363,7 +1406,7 @@
 			]);
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated')
 			]);
 		});
@@ -1390,7 +1433,7 @@
 			assert.ok(nextResponse.success);
 
 			return Promise.all([
-				dc.disconnectRequest({restart: false}),
+				dc.disconnectRequest({ restart: false }),
 				dc.waitForEvent('terminated')
 			]);
 		});
@@ -1423,7 +1466,7 @@
 			const execFile = util.promisify(cp.execFile);
 			const child = await execFile(goRuntimePath,
 				['build', '-o', outputFile, `--gcflags='all=-N -l'`, '.'],
-				{cwd});
+				{ cwd });
 			if (child.stderr.length > 0) {
 				throw Error(child.stderr);
 			}
@@ -1440,15 +1483,15 @@
 				rmdirRecursive(goBuildOutput);
 			});
 
-			async function copyBuildDelete(program: string): Promise<{program: string, output: string}> {
+			async function copyBuildDelete(program: string): Promise<{ program: string, output: string }> {
 				const wd = copyDirectory(program);
 				const output = await buildGoProgram(wd, path.join(goBuildOutput, program));
 				rmdirRecursive(wd);
-				return {program: wd, output};
+				return { program: wd, output };
 			}
 
 			test('should stop on a breakpoint set in file with substituted path', async () => {
-				const {program, output} = await copyBuildDelete('baseTest');
+				const { program, output } = await copyBuildDelete('baseTest');
 				const FILE = path.join(DATA_ROOT, 'baseTest', 'test.go');
 				const BREAKPOINT_LINE = 11;
 
@@ -1501,7 +1544,7 @@
 				remoteAttachDebugConfig.cwd = tmpDir;
 				remoteAttachDebugConfig.remotePath = '';
 				remoteAttachDebugConfig.substitutePath = [
-					{from: helloWorldLocal, to: helloWorldRemote}
+					{ from: helloWorldLocal, to: helloWorldRemote }
 				];
 				await setUpRemoteAttach(remoteAttachDebugConfig, [breakpointLocation]);
 
@@ -1510,7 +1553,7 @@
 					() => http.get(`http://localhost:${server}`).on('error', (data) => console.log(data)),
 					breakpointLocation);
 
-				await dc.disconnectRequest({restart: false});
+				await dc.disconnectRequest({ restart: false });
 				await killProcessTree(remoteProgram);
 				await new Promise((resolve) => setTimeout(resolve, 2_000));
 			});
@@ -1528,7 +1571,7 @@
 				remoteAttachDebugConfig.remotePath = helloWorldRemote;
 				// This is a bad mapping, make sure that the remotePath config is used first.
 				remoteAttachDebugConfig.substitutePath = [
-					{from: helloWorldLocal, to: helloWorldLocal}
+					{ from: helloWorldLocal, to: helloWorldLocal }
 				];
 				await setUpRemoteAttach(remoteAttachDebugConfig, [breakpointLocation]);
 
@@ -1537,7 +1580,7 @@
 					() => http.get(`http://localhost:${server}`).on('error', (data) => console.log(data)),
 					breakpointLocation);
 
-				await dc.disconnectRequest({restart: false});
+				await dc.disconnectRequest({ restart: false });
 				await killProcessTree(remoteProgram);
 				await new Promise((resolve) => setTimeout(resolve, 2_000));
 			});