Skip to content

Commit e0e71ba

Browse files
author
Cornelius Weig
committed
Do not store errors because they are never used
1 parent b102395 commit e0e71ba

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

pkg/rakkess/client/resource_access.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ func CheckResourceAccess(ctx context.Context, sar authv1.SelfSubjectAccessReview
6868
allowedVerbs := sets.NewString(gr.APIResource.Verbs...)
6969

7070
access := make(map[string]int)
71-
var errs []error
7271
for _, v := range verbs {
7372

7473
// stop if cancelled
@@ -94,21 +93,17 @@ func CheckResourceAccess(ctx context.Context, sar authv1.SelfSubjectAccessReview
9493
},
9594
},
9695
}
97-
review, e := sar.Create(review)
98-
if e != nil {
99-
errs = append(errs, e)
96+
97+
if review, err := sar.Create(review); err != nil {
10098
access[v] = result.AccessRequestErr
10199
} else {
102100
access[v] = resultFor(&review.Status)
103101
}
104-
105102
}
106103
<-semaphore
107104
allowed <- result.ResourceAccessItem{
108105
Name: gr.fullName(),
109106
Access: access,
110-
// todo(corneliusweig) Err is a write-only field
111-
Err: errs,
112107
}
113108
}(ctx, resultsChan)
114109
}

pkg/rakkess/client/result/resource.go

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ type ResourceAccessItem struct {
2929
Name string
3030
// Access maps from verb to access code.
3131
Access map[string]int
32-
// Err holds access error if a SelfSubjectAccessReview failed.
33-
Err []error
3432
}
3533

3634
// ResourceAccess holds the access result for all resources.

0 commit comments

Comments
 (0)