Skip to content

Commit 570a0a4

Browse files
committed
src/goModules.ts: open go.mod after init
Running go mod init creates a new go.mod file in the workspace folder. However it is currently unclear that the operation ran or succeeded. This change logs messages to the output channel and opens the go.mod file when the command has succeeded. Change-Id: Ie384356612a3da58edbf3d8c7525f6d66084486d Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/322929 Trust: Suzy Mueller <[email protected]> Run-TryBot: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent 936ecdf commit 570a0a4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/goModules.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,15 @@ export async function goModInit() {
200200
try {
201201
const env = toolExecutionEnvironment();
202202
const cwd = getWorkspaceFolderPath();
203+
outputChannel.appendLine(`Running "${goRuntimePath} mod init ${moduleName}"`);
203204
await execFile(goRuntimePath, ['mod', 'init', moduleName], { env, cwd });
205+
outputChannel.appendLine('Module successfully initialized. You are ready to Go :)');
206+
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(path.join(cwd, 'go.mod')));
204207
} catch (e) {
205208
outputChannel.appendLine(e);
206209
outputChannel.show();
207-
vscode.window.showErrorMessage(`Error running 'go mod init ${moduleName}': See Go output channel for details`);
210+
vscode.window.showErrorMessage(
211+
`Error running "${goRuntimePath} mod init ${moduleName}": See Go output channel for details`
212+
);
208213
}
209214
}

0 commit comments

Comments
 (0)