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
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unused

View file

@ -199,7 +199,7 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
}
containerMetrics := make(map[string]metrics.ContainerMetrics)
earliestTs := pmodel.Latest
earliestTS := pmodel.Latest
// organize all the CPU results
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)
if cpu.Timestamp.Before(earliestTs) {
earliestTs = cpu.Timestamp
if cpu.Timestamp.Before(earliestTS) {
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)
if mem.Timestamp.Before(earliestTs) {
earliestTs = mem.Timestamp
if mem.Timestamp.Before(earliestTS) {
earliestTS = mem.Timestamp
}
}
@ -250,7 +250,7 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
CreationTimestamp: metav1.Now(),
},
// store the time in the final format
Timestamp: metav1.NewTime(earliestTs.Time()),
Timestamp: metav1.NewTime(earliestTS.Time()),
Window: metav1.Duration{Duration: p.window},
}