lib/promscrape/discovery/kubernetes: make golangci-lint happy by removing empty branches

This commit is contained in:
Aliaksandr Valialkin 2021-05-20 12:00:07 +03:00
parent 180829b8c2
commit 110a888e39

View File

@ -573,15 +573,11 @@ func (uw *urlWatcher) readObjectUpdateStream(r io.Reader) error {
key := o.key() key := o.key()
uw.gw.mu.Lock() uw.gw.mu.Lock()
if _, ok := uw.objectsByKey[key]; !ok { if _, ok := uw.objectsByKey[key]; !ok {
if we.Type == "MODIFIED" { // if we.Type == "MODIFIED" is expected condition after recovering from the bookmarked resourceVersion.
// This is expected condition after recovering from the bookmarked resourceVersion.
}
uw.objectsCount.Inc() uw.objectsCount.Inc()
uw.objectsAdded.Inc() uw.objectsAdded.Inc()
} else { } else {
if we.Type == "ADDED" { // if we.Type == "ADDED" is expected condition after recovering from the bookmarked resourceVersion.
// This is expected condition after recovering from the bookmarked resourceVersion.
}
uw.objectsUpdated.Inc() uw.objectsUpdated.Inc()
} }
uw.objectsByKey[key] = o uw.objectsByKey[key] = o
@ -599,9 +595,7 @@ func (uw *urlWatcher) readObjectUpdateStream(r io.Reader) error {
} }
key := o.key() key := o.key()
uw.gw.mu.Lock() uw.gw.mu.Lock()
if _, ok := uw.objectsByKey[key]; !ok { if _, ok := uw.objectsByKey[key]; ok {
// This is expected condition after recovering from the bookmarked resourceVersion.
} else {
uw.objectsCount.Dec() uw.objectsCount.Dec()
uw.objectsRemoved.Inc() uw.objectsRemoved.Inc()
delete(uw.objectsByKey, key) delete(uw.objectsByKey, key)