@@ -47,10 +47,10 @@ type webhookScaffolder struct {
47
47
}
48
48
49
49
// 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 {
51
51
return & webhookScaffolder {
52
- config : config ,
53
- resource : resource ,
52
+ config : cfg ,
53
+ resource : res ,
54
54
force : force ,
55
55
}
56
56
}
@@ -116,17 +116,17 @@ func (s *webhookScaffolder) Scaffold() error {
116
116
kustomizeFilePath := "config/default/kustomization.yaml"
117
117
err = pluginutil .UncommentCode (kustomizeFilePath , "#- ../webhook" , `#` )
118
118
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 {
121
121
log .Errorf ("Unable to find the target #- ../webhook to uncomment in the file " +
122
122
"%s." , kustomizeFilePath )
123
123
}
124
124
}
125
125
126
126
err = pluginutil .UncommentCode (kustomizeFilePath , "#patches:" , `#` )
127
127
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 {
130
130
log .Errorf ("Unable to find the line '#patches:' to uncomment in the file " +
131
131
"%s." , kustomizeFilePath )
132
132
}
@@ -136,8 +136,9 @@ func (s *webhookScaffolder) Scaffold() error {
136
136
# target:
137
137
# kind: Deployment` , `#` )
138
138
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 {
141
142
log .Errorf ("Unable to find the target #- path: manager_webhook_patch.yaml to uncomment in the file " +
142
143
"%s." , kustomizeFilePath )
143
144
}
0 commit comments