Skip to content

Commit 80b25a7

Browse files
authored
Merge pull request kubernetes#85037 from hvaara/fix-golint-pkg-apis-authorization
Fix golint issues in pkg/apis/authorization
2 parents afac2ca + 8d3c74a commit 80b25a7

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

hack/.golint_failures

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ pkg/apis/apps/v1beta1
1515
pkg/apis/apps/v1beta2
1616
pkg/apis/auditregistration/v1alpha1
1717
pkg/apis/authentication/v1
18-
pkg/apis/authorization/v1
19-
pkg/apis/authorization/validation
2018
pkg/apis/autoscaling/v1
2119
pkg/apis/autoscaling/v2beta1
2220
pkg/apis/autoscaling/v2beta2

pkg/apis/authorization/v1/register.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ func Resource(resource string) schema.GroupResource {
3333
}
3434

3535
var (
36+
// localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package,
37+
// defaulting and conversion init funcs are registered as well.
3638
localSchemeBuilder = &authorizationv1.SchemeBuilder
37-
AddToScheme = localSchemeBuilder.AddToScheme
39+
// AddToScheme is a global function that registers this API group & version to a scheme
40+
AddToScheme = localSchemeBuilder.AddToScheme
3841
)
3942

4043
func init() {

pkg/apis/authorization/validation/validation.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
authorizationapi "k8s.io/kubernetes/pkg/apis/authorization"
2424
)
2525

26+
// ValidateSubjectAccessReviewSpec validates a SubjectAccessReviewSpec and returns an
27+
// ErrorList with any errors.
2628
func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList {
2729
allErrs := field.ErrorList{}
2830
if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil {
@@ -38,6 +40,8 @@ func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSp
3840
return allErrs
3941
}
4042

43+
// ValidateSelfSubjectAccessReviewSpec validates a SelfSubjectAccessReviewSpec and returns an
44+
// ErrorList with any errors.
4145
func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList {
4246
allErrs := field.ErrorList{}
4347
if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil {
@@ -50,10 +54,14 @@ func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccess
5054
return allErrs
5155
}
5256

57+
// ValidateSelfSubjectRulesReview validates a SelfSubjectRulesReview and returns an
58+
// ErrorList with any errors.
5359
func ValidateSelfSubjectRulesReview(review *authorizationapi.SelfSubjectRulesReview) field.ErrorList {
5460
return field.ErrorList{}
5561
}
5662

63+
// ValidateSubjectAccessReview validates a SubjectAccessReview and returns an
64+
// ErrorList with any errors.
5765
func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) field.ErrorList {
5866
allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))
5967
objectMetaShallowCopy := sar.ObjectMeta
@@ -64,6 +72,8 @@ func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) fiel
6472
return allErrs
6573
}
6674

75+
// ValidateSelfSubjectAccessReview validates a SelfSubjectAccessReview and returns an
76+
// ErrorList with any errors.
6777
func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessReview) field.ErrorList {
6878
allErrs := ValidateSelfSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))
6979
objectMetaShallowCopy := sar.ObjectMeta
@@ -74,6 +84,8 @@ func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessRevi
7484
return allErrs
7585
}
7686

87+
// ValidateLocalSubjectAccessReview validates a LocalSubjectAccessReview and returns an
88+
// ErrorList with any errors.
7789
func ValidateLocalSubjectAccessReview(sar *authorizationapi.LocalSubjectAccessReview) field.ErrorList {
7890
allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))
7991

0 commit comments

Comments
 (0)