[release] src/goDebugConfiguration.ts: add resolveDebugConfiguration back

https://go-review.googlesource.com/c/vscode-go/+/248659 replaced
resolveDebugConfiguration with resolveDebugConfigurationWithSubstitutedVariables
in order to resolve the envFile correctly in case
the property requires substitution.

I thought, when debug is requested without launch.json, the default
debugConfiguration provided by provideDebugConfiguration would be
used and eventually resolveDebugConfigurationWithSubstitutedVariables
would be called to process it further. However, it doesn't seem that's the case.

Instead, I observed, resolveDebugConfiguration is called first
with an empty debugConfiguration and VS Code just drops the launch
request without calling resolveDebugConfigurationWithSubstitutedVariables
at all.

We still need to implement resolveDebugConfiguration and
let it populate the debugConfiguration.

Fixes golang/vscode-go#640

Change-Id: I693c19df1a47cb1011cccdd2f582b4cf3c0fc2ab
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/254843
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
(cherry picked from commit 59858d7848c58fce0eb874a50957eab734c8e296)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/255117
diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts
index e4528ab..1e3d4e4 100644
--- a/src/goDebugConfiguration.ts
+++ b/src/goDebugConfiguration.ts
@@ -34,7 +34,7 @@
 		];
 	}
 
-	public resolveDebugConfigurationWithSubstitutedVariables(
+	public resolveDebugConfiguration(
 		folder: vscode.WorkspaceFolder | undefined,
 		debugConfiguration: vscode.DebugConfiguration,
 		token?: vscode.CancellationToken
@@ -62,9 +62,6 @@
 		debugConfiguration['packagePathToGoModPathMap'] = packagePathToGoModPathMap;
 
 		const goConfig = getGoConfig(folder && folder.uri);
-
-		combineEnvFilesAndEnv(folder, debugConfiguration);
-
 		const dlvConfig = goConfig.get<any>('delveConfig');
 		let useApiV1 = false;
 		if (debugConfiguration.hasOwnProperty('useApiV1')) {
@@ -126,6 +123,26 @@
 		return debugConfiguration;
 	}
 
+	public resolveDebugConfigurationWithSubstitutedVariables(
+		folder: vscode.WorkspaceFolder | undefined,
+		debugConfiguration: vscode.DebugConfiguration,
+		token?: vscode.CancellationToken
+	): vscode.DebugConfiguration {
+		// Reads debugConfiguration.envFile and
+		// combines the environment variables from all the env files and
+		// debugConfiguration.env, on top of the tools execution environment variables.
+		// It also unsets 'envFile' from the user-suppled debugConfiguration
+		// because it is already applied.
+		const goToolsEnvVars = toolExecutionEnvironment(folder?.uri); // also includes GOPATH: getCurrentGoPath().
+		const fileEnvs = parseEnvFiles(debugConfiguration['envFile']);
+		const env = debugConfiguration['env'] || {};
+
+		debugConfiguration['env'] = Object.assign(goToolsEnvVars, fileEnvs, env);
+		debugConfiguration['envFile'] = undefined;  // unset, since we already processed.
+
+		return debugConfiguration;
+	}
+
 	private showWarning(ignoreWarningKey: string, warningMessage: string) {
 		const ignoreWarning = getFromGlobalState(ignoreWarningKey);
 		if (ignoreWarning) {
@@ -140,18 +157,3 @@
 		});
 	}
 }
-
-// combineEnvFilesAndEnv reads debugConfiguration.envFile and
-// combines the environment variables from all the env files and
-// debugConfiguration.env, on top of the tools execution environment variables.
-// It also unsets 'envFile' from the user-suppled debugConfiguration
-// because it is already applied.
-function combineEnvFilesAndEnv(
-	folder: vscode.WorkspaceFolder, debugConfiguration: vscode.DebugConfiguration) {
-	const goToolsEnvVars = toolExecutionEnvironment(folder?.uri); // also includes GOPATH: getCurrentGoPath().
-	const fileEnvs = parseEnvFiles(debugConfiguration['envFile']);
-	const env = debugConfiguration['env'] || {};
-
-	debugConfiguration['env'] = Object.assign(goToolsEnvVars, fileEnvs, env);
-	debugConfiguration['envFile'] = undefined;  // unset, since we already processed.
-}