Skip to content

Commit

Permalink
enable golangci-lint gosimple and fix lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: gy95 <1015105054@qq.com>
  • Loading branch information
gy95 committed Aug 12, 2021
1 parent d60805f commit 55c43cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ linters:
# linters default enabled by golangci-lint .
- deadcode
#- errcheck
#- gosimple
- gosimple
- ineffassign
- staticcheck
- structcheck
Expand Down
10 changes: 5 additions & 5 deletions pkg/scheduler/api/resource_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (r *Resource) Less(rr *Resource, defaultValue DimensionDefaultValue) bool {
r.setDefaultValue(leftResource, rightResource, defaultValue)

for resourceName, leftValue := range leftResource.ScalarResources {
rightValue, _ := rightResource.ScalarResources[resourceName]
rightValue := rightResource.ScalarResources[resourceName]
if rightValue == -1 {
continue
}
Expand Down Expand Up @@ -328,7 +328,7 @@ func (r *Resource) LessEqual(rr *Resource, defaultValue DimensionDefaultValue) b
r.setDefaultValue(leftResource, rightResource, defaultValue)

for resourceName, leftValue := range leftResource.ScalarResources {
rightValue, _ := rightResource.ScalarResources[resourceName]
rightValue := rightResource.ScalarResources[resourceName]
if rightValue == -1 {
continue
}
Expand Down Expand Up @@ -357,7 +357,7 @@ func (r *Resource) LessPartly(rr *Resource, defaultValue DimensionDefaultValue)
r.setDefaultValue(leftResource, rightResource, defaultValue)

for resourceName, leftValue := range leftResource.ScalarResources {
rightValue, _ := rightResource.ScalarResources[resourceName]
rightValue := rightResource.ScalarResources[resourceName]
if leftValue == -1 {
continue
}
Expand Down Expand Up @@ -389,7 +389,7 @@ func (r *Resource) LessEqualPartly(rr *Resource, defaultValue DimensionDefaultVa
r.setDefaultValue(leftResource, rightResource, defaultValue)

for resourceName, leftValue := range leftResource.ScalarResources {
rightValue, _ := rightResource.ScalarResources[resourceName]
rightValue := rightResource.ScalarResources[resourceName]
if leftValue == -1 {
continue
}
Expand Down Expand Up @@ -418,7 +418,7 @@ func (r *Resource) Equal(rr *Resource, defaultValue DimensionDefaultValue) bool
r.setDefaultValue(leftResource, rightResource, defaultValue)

for resourceName, leftValue := range leftResource.ScalarResources {
rightValue, _ := rightResource.ScalarResources[resourceName]
rightValue := rightResource.ScalarResources[resourceName]
if !equalFunc(leftValue, rightValue, minResource) {
return false
}
Expand Down
1 change: 0 additions & 1 deletion pkg/webhooks/admission/pods/mutate/mutate_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func Pods(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
switch ar.Request.Operation {
case v1beta1.Create:
patchBytes, _ = createPatch(pod)
break
default:
err = fmt.Errorf("expect operation to be 'CREATE' ")
return util.ToAdmissionResponse(err)
Expand Down

0 comments on commit 55c43cf

Please sign in to comment.