@@ -189,10 +189,7 @@ func (p Package) install(
189
189
)
190
190
} else if ! ok {
191
191
cfg .Logger .Debug (
192
- fmt .Sprintf (
193
- "skipping install step due to condition: %s" ,
194
- installStep .Condition ,
195
- ),
192
+ "skipping install step due to condition: " + installStep .Condition ,
196
193
)
197
194
continue
198
195
}
@@ -302,10 +299,7 @@ func (p Package) uninstall(
302
299
return NewInstallStepConditionError (installStep .Condition , err )
303
300
} else if ! ok {
304
301
cfg .Logger .Debug (
305
- fmt .Sprintf (
306
- "skipping uninstall step due to condition: %s" ,
307
- installStep .Condition ,
308
- ),
302
+ "skipping uninstall step due to condition: " + installStep .Condition ,
309
303
)
310
304
continue
311
305
}
@@ -393,10 +387,7 @@ func (p Package) activate(cfg Config, context string) error {
393
387
return NewInstallStepConditionError (installStep .Condition , err )
394
388
} else if ! ok {
395
389
cfg .Logger .Debug (
396
- fmt .Sprintf (
397
- "skipping install step due to condition: %s" ,
398
- installStep .Condition ,
399
- ),
390
+ "skipping install step due to condition: " + installStep .Condition ,
400
391
)
401
392
continue
402
393
}
@@ -425,10 +416,7 @@ func (p Package) deactivate(cfg Config, context string) error {
425
416
return NewInstallStepConditionError (installStep .Condition , err )
426
417
} else if ! ok {
427
418
cfg .Logger .Debug (
428
- fmt .Sprintf (
429
- "skipping install step due to condition: %s" ,
430
- installStep .Condition ,
431
- ),
419
+ "skipping install step due to condition: " + installStep .Condition ,
432
420
)
433
421
continue
434
422
}
@@ -451,7 +439,7 @@ func (p Package) deactivate(cfg Config, context string) error {
451
439
func (p Package ) validate (cfg Config ) error {
452
440
// Check empty name
453
441
if p .Name == "" {
454
- return fmt . Errorf ("package name cannot be empty" )
442
+ return errors . New ("package name cannot be empty" )
455
443
}
456
444
// Check name matches allowed characters
457
445
reName := regexp .MustCompile (`^[-a-zA-Z0-9]+$` )
@@ -460,7 +448,7 @@ func (p Package) validate(cfg Config) error {
460
448
}
461
449
// Check empty version
462
450
if p .Version == "" {
463
- return fmt . Errorf ("package version cannot be empty" )
451
+ return errors . New ("package version cannot be empty" )
464
452
}
465
453
// Check version is well formed
466
454
if _ , err := version .NewVersion (p .Version ); err != nil {
@@ -535,7 +523,7 @@ func (p Package) startService(cfg Config, context string) error {
535
523
}
536
524
// Start the Docker container if it's not running
537
525
slog .Info (
538
- fmt . Sprintf ( "Starting Docker container %s" , containerName ) ,
526
+ "Starting Docker container " + containerName ,
539
527
)
540
528
if err := dockerService .Start (); err != nil {
541
529
startErrors = append (
@@ -588,7 +576,7 @@ func (p Package) stopService(cfg Config, context string) error {
588
576
continue
589
577
}
590
578
// Stop the Docker container
591
- slog .Info (fmt . Sprintf ( "Stopping container %s" , containerName ) )
579
+ slog .Info ("Stopping container " + containerName )
592
580
if err := dockerService .Stop (); err != nil {
593
581
stopErrors = append (
594
582
stopErrors ,
@@ -685,7 +673,7 @@ type PackageInstallStepDocker struct {
685
673
686
674
func (p * PackageInstallStepDocker ) validate (cfg Config ) error {
687
675
if p .Image == "" {
688
- return fmt . Errorf ("docker image must be provided" )
676
+ return errors . New ("docker image must be provided" )
689
677
}
690
678
// TODO: add more checks
691
679
return nil
@@ -808,10 +796,7 @@ func (p *PackageInstallStepDocker) uninstall(
808
796
if err != nil {
809
797
if err == ErrContainerNotExists {
810
798
cfg .Logger .Debug (
811
- fmt .Sprintf (
812
- "container missing on uninstall: %s" ,
813
- containerName ,
814
- ),
799
+ "container missing on uninstall: " + containerName ,
815
800
)
816
801
} else {
817
802
return err
@@ -932,7 +917,7 @@ func (p *PackageInstallStepFile) install(
932
917
return err
933
918
}
934
919
if u .Scheme == "" || u .Host == "" {
935
- return fmt . Errorf ("invalid URL given..." )
920
+ return errors . New ("invalid URL given..." )
936
921
}
937
922
938
923
// Fetch data
@@ -951,12 +936,12 @@ func (p *PackageInstallStepFile) install(
951
936
952
937
fileContent = respBody
953
938
} else {
954
- return fmt . Errorf ("packages must provide content, source, or url for file install types" )
939
+ return errors . New ("packages must provide content, source, or url for file install types" )
955
940
}
956
941
if err := os .WriteFile (filePath , fileContent , fileMode ); err != nil {
957
942
return err
958
943
}
959
- cfg .Logger .Debug (fmt . Sprintf ( "wrote file %s" , filePath ) )
944
+ cfg .Logger .Debug ("wrote file " + filePath )
960
945
return nil
961
946
}
962
947
@@ -966,10 +951,10 @@ func (p *PackageInstallStepFile) uninstall(cfg Config, pkgName string) error {
966
951
pkgName ,
967
952
p .Filename ,
968
953
)
969
- cfg .Logger .Debug (fmt . Sprintf ( "deleting file %s" , filePath ) )
954
+ cfg .Logger .Debug ("deleting file " + filePath )
970
955
if err := os .Remove (filePath ); err != nil {
971
956
if ! errors .Is (err , fs .ErrNotExist ) {
972
- cfg .Logger .Warn (fmt . Sprintf ( "failed to remove file %s" , filePath ) )
957
+ cfg .Logger .Warn ("failed to remove file " + filePath )
973
958
}
974
959
}
975
960
return nil
@@ -1043,7 +1028,7 @@ func (p *PackageInstallStepFile) deactivate(cfg Config, pkgName string) error {
1043
1028
return err
1044
1029
}
1045
1030
}
1046
- cfg .Logger .Debug (fmt . Sprintf ( "removed symlink %s" , binPath ) )
1031
+ cfg .Logger .Debug ("removed symlink " + binPath )
1047
1032
}
1048
1033
return nil
1049
1034
}
0 commit comments