@@ -3,7 +3,6 @@ package jetbrains
33import (
44 "bufio"
55 "fmt"
6- "io/ioutil"
76 "net/http"
87 "os"
98 "path/filepath"
@@ -149,7 +148,7 @@ func (jc *JetbrainsCommand) validateRepository(repoURL string) error {
149148 if resp .StatusCode == http .StatusNotFound {
150149 return fmt .Errorf ("repository not found (404). Please verify the repository key '%s' exists" , jc .repoKey )
151150 }
152- if resp .StatusCode >= 400 && resp .StatusCode != 401 {
151+ if resp .StatusCode >= 400 && resp .StatusCode != http . StatusUnauthorized {
153152 return fmt .Errorf ("repository returned status %d. Please verify the repository is accessible" , resp .StatusCode )
154153 }
155154
@@ -184,7 +183,7 @@ func (jc *JetbrainsCommand) detectJetBrainsIDEs() error {
184183 }
185184
186185 // Scan for IDE configurations
187- entries , err := ioutil .ReadDir (configBasePath )
186+ entries , err := os .ReadDir (configBasePath )
188187 if err != nil {
189188 return fmt .Errorf ("failed to read JetBrains configuration directory: %w" , err )
190189 }
@@ -250,21 +249,21 @@ func (jc *JetbrainsCommand) createBackup(ide IDEInstallation) error {
250249 // If properties file doesn't exist, create an empty backup
251250 if _ , err := os .Stat (ide .PropertiesPath ); os .IsNotExist (err ) {
252251 // Create empty file for backup record
253- if err := ioutil .WriteFile (backupPath , []byte ("# Empty properties file backup\n " ), 0644 ); err != nil {
252+ if err := os .WriteFile (backupPath , []byte ("# Empty properties file backup\n " ), 0644 ); err != nil {
254253 return fmt .Errorf ("failed to create backup marker: %w" , err )
255254 }
256255 jc .backupPaths [ide .PropertiesPath ] = backupPath
257256 return nil
258257 }
259258
260259 // Read existing properties file
261- data , err := ioutil .ReadFile (ide .PropertiesPath )
260+ data , err := os .ReadFile (ide .PropertiesPath )
262261 if err != nil {
263262 return fmt .Errorf ("failed to read properties file: %w" , err )
264263 }
265264
266265 // Write backup
267- if err := ioutil .WriteFile (backupPath , data , 0644 ); err != nil {
266+ if err := os .WriteFile (backupPath , data , 0644 ); err != nil {
268267 return fmt .Errorf ("failed to create backup: %w" , err )
269268 }
270269
@@ -280,7 +279,7 @@ func (jc *JetbrainsCommand) restoreBackup(ide IDEInstallation) error {
280279 return fmt .Errorf ("no backup path available for %s" , ide .PropertiesPath )
281280 }
282281
283- data , err := ioutil .ReadFile (backupPath )
282+ data , err := os .ReadFile (backupPath )
284283 if err != nil {
285284 return fmt .Errorf ("failed to read backup: %w" , err )
286285 }
@@ -294,7 +293,7 @@ func (jc *JetbrainsCommand) restoreBackup(ide IDEInstallation) error {
294293 return nil
295294 }
296295
297- if err := ioutil .WriteFile (ide .PropertiesPath , data , 0644 ); err != nil {
296+ if err := os .WriteFile (ide .PropertiesPath , data , 0644 ); err != nil {
298297 return fmt .Errorf ("failed to restore backup: %w" , err )
299298 }
300299
@@ -309,7 +308,7 @@ func (jc *JetbrainsCommand) modifyPropertiesFile(ide IDEInstallation, repoURL st
309308
310309 // Read existing properties if file exists
311310 if _ , err := os .Stat (ide .PropertiesPath ); err == nil {
312- data , err := ioutil .ReadFile (ide .PropertiesPath )
311+ data , err := os .ReadFile (ide .PropertiesPath )
313312 if err != nil {
314313 return fmt .Errorf ("failed to read properties file: %w" , err )
315314 }
@@ -352,7 +351,7 @@ func (jc *JetbrainsCommand) modifyPropertiesFile(ide IDEInstallation, repoURL st
352351
353352 // Write modified properties file
354353 content := strings .Join (lines , "\n " ) + "\n "
355- if err := ioutil .WriteFile (ide .PropertiesPath , []byte (content ), 0644 ); err != nil {
354+ if err := os .WriteFile (ide .PropertiesPath , []byte (content ), 0644 ); err != nil {
356355 return fmt .Errorf ("failed to write properties file: %w" , err )
357356 }
358357
0 commit comments