@@ -47,10 +47,10 @@ type webhookScaffolder struct {
4747}
4848
4949// NewWebhookScaffolder returns a new Scaffolder for v2 webhook creation operations
50- func NewWebhookScaffolder (config config.Config , resource resource.Resource , force bool ) plugins.Scaffolder {
50+ func NewWebhookScaffolder (cfg config.Config , res resource.Resource , force bool ) plugins.Scaffolder {
5151 return & webhookScaffolder {
52- config : config ,
53- resource : resource ,
52+ config : cfg ,
53+ resource : res ,
5454 force : force ,
5555 }
5656}
@@ -116,17 +116,17 @@ func (s *webhookScaffolder) Scaffold() error {
116116 kustomizeFilePath := "config/default/kustomization.yaml"
117117 err = pluginutil .UncommentCode (kustomizeFilePath , "#- ../webhook" , `#` )
118118 if err != nil {
119- hasWebHookUncommented , err := pluginutil .HasFileContentWith (kustomizeFilePath , "- ../webhook" )
120- if ! hasWebHookUncommented || err != nil {
119+ hasWebHookUncommented , errCheck := pluginutil .HasFileContentWith (kustomizeFilePath , "- ../webhook" )
120+ if ! hasWebHookUncommented || errCheck != nil {
121121 log .Errorf ("Unable to find the target #- ../webhook to uncomment in the file " +
122122 "%s." , kustomizeFilePath )
123123 }
124124 }
125125
126126 err = pluginutil .UncommentCode (kustomizeFilePath , "#patches:" , `#` )
127127 if err != nil {
128- hasWebHookUncommented , err := pluginutil .HasFileContentWith (kustomizeFilePath , "patches:" )
129- if ! hasWebHookUncommented || err != nil {
128+ hasWebHookUncommented , errCheck := pluginutil .HasFileContentWith (kustomizeFilePath , "patches:" )
129+ if ! hasWebHookUncommented || errCheck != nil {
130130 log .Errorf ("Unable to find the line '#patches:' to uncomment in the file " +
131131 "%s." , kustomizeFilePath )
132132 }
@@ -136,8 +136,9 @@ func (s *webhookScaffolder) Scaffold() error {
136136# target:
137137# kind: Deployment` , `#` )
138138 if err != nil {
139- hasWebHookUncommented , err := pluginutil .HasFileContentWith (kustomizeFilePath , "- path: manager_webhook_patch.yaml" )
140- if ! hasWebHookUncommented || err != nil {
139+ hasWebHookUncommented , errCheck := pluginutil .HasFileContentWith (kustomizeFilePath ,
140+ "- path: manager_webhook_patch.yaml" )
141+ if ! hasWebHookUncommented || errCheck != nil {
141142 log .Errorf ("Unable to find the target #- path: manager_webhook_patch.yaml to uncomment in the file " +
142143 "%s." , kustomizeFilePath )
143144 }
0 commit comments