Skip to content

Commit c1bacc7

Browse files
authored
Merge pull request #4111 from camilamacedo86/fix-linter-samples
🐛 (go/v4): Fix linter issues in the scaffold
2 parents a1457ac + e4ef218 commit c1bacc7

File tree

22 files changed

+33
-1
lines changed

22 files changed

+33
-1
lines changed

docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ func main() {
181181
182182
We'll just make sure to set `ENABLE_WEBHOOKS=false` when we run locally.
183183
*/
184+
// nolint:goconst
184185
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
185186
if err = (&batchv1.CronJob{}).SetupWebhookWithManager(mgr); err != nil {
186187
setupLog.Error(err, "unable to create webhook", "webhook", "CronJob")

hack/docs/internal/cronjob-tutorial/generate_cronjob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ func (sp *Sample) updateWebhook() {
392392
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
393393
)
394394
395+
// nolint:unused
395396
// log is for logging in this package.
396397
`, WebhookIntro)
397398
hackutils.CheckError("fixing cronjob_webhook.go", err)

pkg/plugins/golang/v4/scaffolds/internal/templates/api/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import (
9595
9696
)
9797
98+
// nolint:unused
9899
// log is for logging in this package.
99100
var {{ lower .Resource.Kind }}log = logf.Log.WithName("{{ lower .Resource.Kind }}-resource")
100101

pkg/plugins/golang/v4/scaffolds/internal/templates/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ const (
114114
os.Exit(1)
115115
}
116116
`
117-
webhookSetupCodeFragment = `if os.Getenv("ENABLE_WEBHOOKS") != "false" {
117+
webhookSetupCodeFragment = `// nolint:goconst
118+
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
118119
if err = (&%s.%s{}).SetupWebhookWithManager(mgr); err != nil {
119120
setupLog.Error(err, "unable to create webhook", "webhook", "%s")
120121
os.Exit(1)

testdata/project-v4-multigroup-with-deploy-image/api/crew/v1/captain_webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2525
)
2626

27+
// nolint:unused
2728
// log is for logging in this package.
2829
var captainlog = logf.Log.WithName("captain-resource")
2930

testdata/project-v4-multigroup-with-deploy-image/api/ship/v1/destroyer_webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"sigs.k8s.io/controller-runtime/pkg/webhook"
2323
)
2424

25+
// nolint:unused
2526
// log is for logging in this package.
2627
var destroyerlog = logf.Log.WithName("destroyer-resource")
2728

testdata/project-v4-multigroup-with-deploy-image/api/ship/v1beta1/frigate_webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
logf "sigs.k8s.io/controller-runtime/pkg/log"
2222
)
2323

24+
// nolint:unused
2425
// log is for logging in this package.
2526
var frigatelog = logf.Log.WithName("frigate-resource")
2627

testdata/project-v4-multigroup-with-deploy-image/api/ship/v2alpha1/cruiser_webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2525
)
2626

27+
// nolint:unused
2728
// log is for logging in this package.
2829
var cruiserlog = logf.Log.WithName("cruiser-resource")
2930

testdata/project-v4-multigroup-with-deploy-image/api/v1/lakers_webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2525
)
2626

27+
// nolint:unused
2728
// log is for logging in this package.
2829
var lakerslog = logf.Log.WithName("lakers-resource")
2930

testdata/project-v4-multigroup-with-deploy-image/cmd/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ func main() {
176176
setupLog.Error(err, "unable to create controller", "controller", "Captain")
177177
os.Exit(1)
178178
}
179+
// nolint:goconst
179180
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
180181
if err = (&crewv1.Captain{}).SetupWebhookWithManager(mgr); err != nil {
181182
setupLog.Error(err, "unable to create webhook", "webhook", "Captain")
@@ -189,6 +190,7 @@ func main() {
189190
setupLog.Error(err, "unable to create controller", "controller", "Frigate")
190191
os.Exit(1)
191192
}
193+
// nolint:goconst
192194
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
193195
if err = (&shipv1beta1.Frigate{}).SetupWebhookWithManager(mgr); err != nil {
194196
setupLog.Error(err, "unable to create webhook", "webhook", "Frigate")
@@ -202,6 +204,7 @@ func main() {
202204
setupLog.Error(err, "unable to create controller", "controller", "Destroyer")
203205
os.Exit(1)
204206
}
207+
// nolint:goconst
205208
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
206209
if err = (&shipv1.Destroyer{}).SetupWebhookWithManager(mgr); err != nil {
207210
setupLog.Error(err, "unable to create webhook", "webhook", "Destroyer")
@@ -215,6 +218,7 @@ func main() {
215218
setupLog.Error(err, "unable to create controller", "controller", "Cruiser")
216219
os.Exit(1)
217220
}
221+
// nolint:goconst
218222
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
219223
if err = (&shipv2alpha1.Cruiser{}).SetupWebhookWithManager(mgr); err != nil {
220224
setupLog.Error(err, "unable to create webhook", "webhook", "Cruiser")
@@ -270,6 +274,7 @@ func main() {
270274
setupLog.Error(err, "unable to create controller", "controller", "Lakers")
271275
os.Exit(1)
272276
}
277+
// nolint:goconst
273278
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
274279
if err = (&testprojectorgv1.Lakers{}).SetupWebhookWithManager(mgr); err != nil {
275280
setupLog.Error(err, "unable to create webhook", "webhook", "Lakers")

0 commit comments

Comments
 (0)