Skip to content

Commit 6273725

Browse files
committed
fix: replace HTTP status code magic numbers with standard library constants
- Replace 404 with http.StatusNotFound - Replace 401 with http.StatusUnauthorized - Replace 403 with http.StatusForbidden Fixes usestdlibvars linting issues in IDE setup code.
1 parent 63a79de commit 6273725

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

general/ide/jetbrains/jetbrains.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (jc *JetbrainsCommand) validateRepository(repoURL string) error {
146146
}
147147
defer resp.Body.Close()
148148

149-
if resp.StatusCode == 404 {
149+
if resp.StatusCode == http.StatusNotFound {
150150
return fmt.Errorf("repository not found (404). Please verify the repository key '%s' exists", jc.repoKey)
151151
}
152152
if resp.StatusCode >= 400 && resp.StatusCode != 401 {

general/ide/vscode/vscode.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ func (vc *VscodeCommand) validateRepository(repoURL string) error {
183183
}
184184
defer resp.Body.Close()
185185

186-
if resp.StatusCode == 404 {
186+
if resp.StatusCode == http.StatusNotFound {
187187
log.Warn("Repository not found (404). Please verify the repository exists")
188188
return nil
189189
}
190-
if resp.StatusCode == 401 || resp.StatusCode == 403 {
190+
if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {
191191
log.Warn("Repository requires authentication")
192192
return nil
193193
}
@@ -494,7 +494,7 @@ func (vic *VscodeInstallCommand) validateExtensionRepository(repoURL string) err
494494
}
495495
defer resp.Body.Close()
496496

497-
if resp.StatusCode == 404 {
497+
if resp.StatusCode == http.StatusNotFound {
498498
return fmt.Errorf("extension not found. Please verify publisher '%s' and extension '%s' exist in repository '%s'", vic.publisher, vic.extensionName, vic.repoKey)
499499
}
500500
if resp.StatusCode >= 400 {

0 commit comments

Comments
 (0)