IfStmt with single bool judgement could be simplified
1967 storesETAGauge.DeleteLabelValues(storeAddress, storeLabel, preparingAction)
1968 }
1969 progress = encodeRemovingProgressKey(storeID)
1970 if exist := c.progressManager.RemoveProgress(progress); exist {1971 storesProgressGauge.DeleteLabelValues(storeAddress, storeLabel, removingAction)
1972 storesSpeedGauge.DeleteLabelValues(storeAddress, storeLabel, removingAction)
1973 storesETAGauge.DeleteLabelValues(storeAddress, storeLabel, removingAction)
IfStmt with single bool judgement could be simplified
1961 storeLabel := strconv.FormatUint(storeID, 10)
1962
1963 progress := encodePreparingProgressKey(storeID)
1964 if exist := c.progressManager.RemoveProgress(progress); exist {1965 storesProgressGauge.DeleteLabelValues(storeAddress, storeLabel, preparingAction)
1966 storesSpeedGauge.DeleteLabelValues(storeAddress, storeLabel, preparingAction)
1967 storesETAGauge.DeleteLabelValues(storeAddress, storeLabel, preparingAction)
Description
if
statement can be simplified where only a single bool judgment is happening. It is more
idiomatic not to store the result of a function returning a bool and compare that in if
statement's conditional. It is better to skip the initialization expression.
Bad practice
if ok := fn(); ok {
// body
}
Recommended
if fn() {
// body
}