Merge pull request #550 from olivierlemasle/stylecheck

golangci-lint: Add stylecheck linter
This commit is contained in:
Kubernetes Prow Robot 2022-12-09 06:58:19 -08:00 committed by GitHub
commit 062c42eccc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -23,6 +23,7 @@ linters:
- nolintlint - nolintlint
- revive - revive
- staticcheck - staticcheck
- stylecheck
- typecheck - typecheck
- unconvert - unconvert
- unused - unused

View file

@ -199,7 +199,7 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
} }
containerMetrics := make(map[string]metrics.ContainerMetrics) containerMetrics := make(map[string]metrics.ContainerMetrics)
earliestTs := pmodel.Latest earliestTS := pmodel.Latest
// organize all the CPU results // organize all the CPU results
for _, cpu := range cpuRes { for _, cpu := range cpuRes {
@ -211,8 +211,8 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
} }
} }
containerMetrics[containerName].Usage[corev1.ResourceCPU] = *resource.NewMilliQuantity(int64(cpu.Value*1000.0), resource.DecimalSI) containerMetrics[containerName].Usage[corev1.ResourceCPU] = *resource.NewMilliQuantity(int64(cpu.Value*1000.0), resource.DecimalSI)
if cpu.Timestamp.Before(earliestTs) { if cpu.Timestamp.Before(earliestTS) {
earliestTs = cpu.Timestamp earliestTS = cpu.Timestamp
} }
} }
@ -226,8 +226,8 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
} }
} }
containerMetrics[containerName].Usage[corev1.ResourceMemory] = *resource.NewMilliQuantity(int64(mem.Value*1000.0), resource.BinarySI) containerMetrics[containerName].Usage[corev1.ResourceMemory] = *resource.NewMilliQuantity(int64(mem.Value*1000.0), resource.BinarySI)
if mem.Timestamp.Before(earliestTs) { if mem.Timestamp.Before(earliestTS) {
earliestTs = mem.Timestamp earliestTS = mem.Timestamp
} }
} }
@ -250,7 +250,7 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
CreationTimestamp: metav1.Now(), CreationTimestamp: metav1.Now(),
}, },
// store the time in the final format // store the time in the final format
Timestamp: metav1.NewTime(earliestTs.Time()), Timestamp: metav1.NewTime(earliestTS.Time()),
Window: metav1.Duration{Duration: p.window}, Window: metav1.Duration{Duration: p.window},
} }