Skip to content

Commit a06a929

Browse files
Fix variable shadowing issues in sourcemaps upload command
Co-Authored-By: [email protected] <[email protected]>
1 parent 506d2b1 commit a06a929

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

cmd/sourcemaps/upload.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"os"
77
"os/exec"
8-
"strings"
98

109
"github.com/spf13/cobra"
1110
"github.com/spf13/viper"
@@ -96,33 +95,33 @@ func runE(client resources.Client) func(cmd *cobra.Command, args []string) error
9695
return fmt.Errorf("Node.js is required to upload sourcemaps: %v", err)
9796
}
9897

99-
args := []string{npmPackage, "upload", "--apiKey", apiKey}
98+
npxArgs := []string{npmPackage, "upload", "--apiKey", apiKey}
10099

101100
if appVersion != "" {
102-
args = append(args, "--appVersion", appVersion)
101+
npxArgs = append(npxArgs, "--appVersion", appVersion)
103102
}
104103

105104
if path != defaultPath {
106-
args = append(args, "--path", path)
105+
npxArgs = append(npxArgs, "--path", path)
107106
}
108107

109108
if basePath != "" {
110-
args = append(args, "--basePath", basePath)
109+
npxArgs = append(npxArgs, "--basePath", basePath)
111110
}
112111

113112
if backendUrl != defaultBackendUrl {
114-
args = append(args, "--backendUrl", backendUrl)
113+
npxArgs = append(npxArgs, "--backendUrl", backendUrl)
115114
}
116115

117116
fmt.Printf("Starting to upload source maps from %s using %s\n", path, npmPackage)
118117

119-
cmd := exec.Command("npx", args...)
118+
execCmd := exec.Command("npx", npxArgs...)
120119
var stdout, stderr bytes.Buffer
121-
cmd.Stdout = &stdout
122-
cmd.Stderr = &stderr
123-
cmd.Env = os.Environ()
120+
execCmd.Stdout = &stdout
121+
execCmd.Stderr = &stderr
122+
execCmd.Env = os.Environ()
124123

125-
err := cmd.Run()
124+
err := execCmd.Run()
126125
fmt.Print(stdout.String())
127126

128127
if err != nil {

0 commit comments

Comments
 (0)