Add golangci-lint workflow (#4999)

* fix lint workflow

* add golang lint

* close http response body
This commit is contained in:
andrew_li
2022-06-29 11:58:36 +08:00
committed by GitHub
parent f1e06466df
commit f289795312
141 changed files with 311 additions and 592 deletions

View File

@@ -179,7 +179,7 @@ func (p *pvcEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageS
var _ quota.Evaluator = &pvcEvaluator{}
func toExternalPersistentVolumeClaimOrError(obj runtime.Object) (*corev1.PersistentVolumeClaim, error) {
pvc := &corev1.PersistentVolumeClaim{}
var pvc *corev1.PersistentVolumeClaim
switch t := obj.(type) {
case *corev1.PersistentVolumeClaim:
pvc = t

View File

@@ -144,10 +144,7 @@ func (p *podEvaluator) GroupResource() schema.GroupResource {
// Handles returns true if the evaluator should handle the specified attributes.
func (p *podEvaluator) Handles(a admission.Attributes) bool {
op := a.GetOperation()
if op == admission.Create {
return true
}
return false
return op == admission.Create
}
// Matches returns true if the evaluator matches the specified quota with the provided input item
@@ -276,7 +273,7 @@ func podComputeUsageHelper(requests corev1.ResourceList, limits corev1.ResourceL
}
func toExternalPodOrError(obj runtime.Object) (*corev1.Pod, error) {
pod := &corev1.Pod{}
var pod *corev1.Pod
switch t := obj.(type) {
case *corev1.Pod:
pod = t

View File

@@ -94,7 +94,7 @@ func (p *serviceEvaluator) UncoveredQuotaScopes(limitedScopes []corev1.ScopedRes
// convert the input object to an internal service object or error.
func toExternalServiceOrError(obj runtime.Object) (*corev1.Service, error) {
svc := &corev1.Service{}
var svc *corev1.Service
switch t := obj.(type) {
case *corev1.Service:
svc = t