Skip to content

Commit 9f7ae89

Browse files
committed
fix review findings
1 parent fff8ec8 commit 9f7ae89

File tree

7 files changed

+3
-9
lines changed

7 files changed

+3
-9
lines changed

pkg/client/client_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,6 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
19791979
// Test this with an integrated type and a CRD to make sure it covers both proto
19801980
// and json deserialization.
19811981
for idx, object := range []client.Object{&corev1.ConfigMap{}, &pkg.ChaosPod{}} {
1982-
idx, object := idx, object
19831982
It(fmt.Sprintf("should not retain any data in the obj variable that is not on the server for %T", object), func() {
19841983
cl, err := client.New(cfg, client.Options{})
19851984
Expect(err).NotTo(HaveOccurred())

pkg/envtest/crd.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ func UninstallCRDs(config *rest.Config, options CRDInstallOptions) error {
229229

230230
// Uninstall each CRD
231231
for _, crd := range options.CRDs {
232-
crd := crd
233232
log.V(1).Info("uninstalling CRD", "crd", crd.GetName())
234233
if err := cs.Delete(context.TODO(), crd); err != nil {
235234
// If CRD is not found, we can consider success
@@ -251,7 +250,6 @@ func CreateCRDs(config *rest.Config, crds []*apiextensionsv1.CustomResourceDefin
251250

252251
// Create each CRD
253252
for _, crd := range crds {
254-
crd := crd
255253
log.V(1).Info("installing CRD", "crd", crd.GetName())
256254
existingCrd := crd.DeepCopy()
257255
err := cs.Get(context.TODO(), client.ObjectKey{Name: crd.GetName()}, existingCrd)

pkg/envtest/envtest_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ var _ = Describe("Test", func() {
5757
// Cleanup CRDs
5858
AfterEach(func() {
5959
for _, crd := range crds {
60-
crd := crd
6160
// Delete only if CRD exists.
6261
crdObjectKey := client.ObjectKey{
6362
Name: crd.GetName(),

pkg/envtest/webhook.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,12 @@ func createWebhooks(config *rest.Config, mutHooks []*admissionv1.MutatingWebhook
313313

314314
// Create each webhook
315315
for _, hook := range mutHooks {
316-
hook := hook
317316
log.V(1).Info("installing mutating webhook", "webhook", hook.GetName())
318317
if err := ensureCreated(cs, hook); err != nil {
319318
return err
320319
}
321320
}
322321
for _, hook := range valHooks {
323-
hook := hook
324322
log.V(1).Info("installing validating webhook", "webhook", hook.GetName())
325323
if err := ensureCreated(cs, hook); err != nil {
326324
return err

pkg/log/zap/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (ev *levelFlag) Set(flagValue string) error {
8585
}
8686
if logLevel > 0 {
8787
intLevel := -1 * logLevel
88-
ev.setFunc(zap.NewAtomicLevelAt(zapcore.Level(int8(intLevel)))) //nolint:gosec // We don't care about G115.
88+
ev.setFunc(zap.NewAtomicLevelAt(zapcore.Level(int8(intLevel)))) //nolint:gosec // We are not worried about integer overflows (G115) here.
8989
} else {
9090
return fmt.Errorf("invalid log level \"%s\"", flagValue)
9191
}

pkg/webhook/admission/response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func ValidationResponse(allowed bool, message string) Response {
7171
AdmissionResponse: admissionv1.AdmissionResponse{
7272
Allowed: allowed,
7373
Result: &metav1.Status{
74-
Code: int32(code), //nolint:gosec // We don't care about G115.
74+
Code: int32(code), //nolint:gosec // Integer overflows (G115) cannot occur here.
7575
Reason: reason,
7676
},
7777
},

tools/setup-envtest/store/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (s *Store) Add(ctx context.Context, item Item, contents io.Reader) (resErr
168168
targetPath := filepath.Base(header.Name)
169169
log.V(1).Info("writing archive file to disk", "archive file", header.Name, "on-disk file", targetPath)
170170
perms := 0555 & header.Mode // make sure we're at most r+x
171-
binOut, err := itemPath.OpenFile(targetPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(perms)) //nolint:gosec // We don't care about G115.
171+
binOut, err := itemPath.OpenFile(targetPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(perms)) //nolint:gosec // Integer overflows (G115) seem unlikely here.
172172
if err != nil {
173173
return fmt.Errorf("unable to create file %s from archive to disk for version-platform pair %s", targetPath, itemName)
174174
}

0 commit comments

Comments
 (0)