@@ -118,13 +118,13 @@ func (s *initScaffolder) Scaffold() error {
118
118
}
119
119
120
120
if err = scaffold .Execute (buildScaffold ... ); err != nil {
121
- return fmt .Errorf ("error scaffolding helm-chart manifests: %v " , err )
121
+ return fmt .Errorf ("error scaffolding helm-chart manifests: %w " , err )
122
122
}
123
123
124
124
// Copy relevant files from config/ to dist/chart/templates/
125
125
err = s .copyConfigFiles ()
126
126
if err != nil {
127
- return fmt .Errorf ("failed to copy manifests from config to dist/chart/templates/: %v " , err )
127
+ return fmt .Errorf ("failed to copy manifests from config to dist/chart/templates/: %w " , err )
128
128
}
129
129
130
130
return nil
@@ -170,7 +170,7 @@ func (s *initScaffolder) extractWebhooksFromGeneratedFiles() (mutatingWebhooks [
170
170
content , err := os .ReadFile (manifestFile )
171
171
if err != nil {
172
172
return nil , nil ,
173
- fmt .Errorf ("failed to read %s : %w" , manifestFile , err )
173
+ fmt .Errorf ("failed to read %q : %w" , manifestFile , err )
174
174
}
175
175
176
176
docs := strings .Split (string (content ), "---" )
@@ -256,7 +256,7 @@ func (s *initScaffolder) copyConfigFiles() error {
256
256
257
257
// Ensure destination directory exists
258
258
if err := os .MkdirAll (dir .DestDir , os .ModePerm ); err != nil {
259
- return fmt .Errorf ("failed to create directory %s : %v " , dir .DestDir , err )
259
+ return fmt .Errorf ("failed to create directory %q : %w " , dir .DestDir , err )
260
260
}
261
261
262
262
for _ , srcFile := range files {
@@ -462,23 +462,23 @@ func getCRDPatchContent(kind, group string) (string, bool, error) {
462
462
groupKindPattern := fmt .Sprintf ("config/crd/patches/webhook_*%s*%s*.yaml" , group , kind )
463
463
patchFiles , err := filepath .Glob (groupKindPattern )
464
464
if err != nil {
465
- return "" , false , fmt .Errorf ("failed to list patches: %v " , err )
465
+ return "" , false , fmt .Errorf ("failed to list patches: %w " , err )
466
466
}
467
467
468
468
// If no group-specific patch found, search for patches that contain only "webhook" and the kind
469
469
if len (patchFiles ) == 0 {
470
470
kindOnlyPattern := fmt .Sprintf ("config/crd/patches/webhook_*%s*.yaml" , kind )
471
471
patchFiles , err = filepath .Glob (kindOnlyPattern )
472
472
if err != nil {
473
- return "" , false , fmt .Errorf ("failed to list patches: %v " , err )
473
+ return "" , false , fmt .Errorf ("failed to list patches: %w " , err )
474
474
}
475
475
}
476
476
477
477
// Read the first matching patch file (if any)
478
478
if len (patchFiles ) > 0 {
479
479
patchContent , err := os .ReadFile (patchFiles [0 ])
480
480
if err != nil {
481
- return "" , false , fmt .Errorf ("failed to read patch file %s : %v " , patchFiles [0 ], err )
481
+ return "" , false , fmt .Errorf ("failed to read patch file %q : %w " , patchFiles [0 ], err )
482
482
}
483
483
return string (patchContent ), true , nil
484
484
}
0 commit comments