data-usage-cache: remove redundant nil check (#17970)

From the Go specification:

  "3. If the map is nil, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun 2023-09-17 10:09:29 +08:00 committed by GitHub
parent 36385010f5
commit a00db4267c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,7 +347,6 @@ func (e *dataUsageEntry) addSizes(summary sizeSummary) {
e.ReplicationStats.ReplicaSize += uint64(summary.replicaSize) e.ReplicationStats.ReplicaSize += uint64(summary.replicaSize)
e.ReplicationStats.ReplicaCount += uint64(summary.replicaCount) e.ReplicationStats.ReplicaCount += uint64(summary.replicaCount)
if summary.replTargetStats != nil {
for arn, st := range summary.replTargetStats { for arn, st := range summary.replTargetStats {
tgtStat, ok := e.ReplicationStats.Targets[arn] tgtStat, ok := e.ReplicationStats.Targets[arn]
if !ok { if !ok {
@ -361,7 +360,6 @@ func (e *dataUsageEntry) addSizes(summary sizeSummary) {
tgtStat.PendingCount += st.pendingCount tgtStat.PendingCount += st.pendingCount
e.ReplicationStats.Targets[arn] = tgtStat e.ReplicationStats.Targets[arn] = tgtStat
} }
}
if summary.tiers != nil { if summary.tiers != nil {
if e.AllTierStats == nil { if e.AllTierStats == nil {
e.AllTierStats = newAllTierStats() e.AllTierStats = newAllTierStats()