Skip to content

Commit ee4f820

Browse files
committed
fix: Resolve dupBranchBody in VSCode extension installation
- Extract common command execution logic to eliminate duplicate branches - Both Windows and non-Windows branches now only differ in executable name - Fixes gocritic dupBranchBody warning in downloadAndInstallExtension function
1 parent 36304bf commit ee4f820

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

general/ide/vscode/vscode.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,14 @@ func (vic *VscodeInstallCommand) downloadAndInstallExtension(repoURL string) err
543543
log.Info("Installing extension using VSCode CLI...")
544544

545545
// Install extension using VSCode's CLI
546-
var cmd *exec.Cmd
546+
var codeCmd string
547547
if runtime.GOOS == "windows" {
548-
cmd = exec.Command("code.cmd", "--install-extension", tempFile, "--force")
548+
codeCmd = "code.cmd"
549549
} else {
550-
cmd = exec.Command("code", "--install-extension", tempFile, "--force")
550+
codeCmd = "code"
551551
}
552552

553+
cmd := exec.Command(codeCmd, "--install-extension", tempFile, "--force")
553554
output, err := cmd.CombinedOutput()
554555
if err != nil {
555556
return fmt.Errorf("failed to install extension via VSCode CLI: %w\nOutput: %s", err, string(output))

0 commit comments

Comments
 (0)