Skip to content

Commit

Permalink
chore: use index in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzyildirim committed Sep 9, 2023
1 parent 5dfab6e commit f950a6a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (s *dcp) SetMetadata(metadata metadata.Metadata) {
}

func (s *dcp) SetMetricCollectors(metricCollectors ...prometheus.Collector) {
s.metricCollectors = metricCollectors
s.metricCollectors = append(metricCollectors, metricCollectors...)

Check failure on line 89 in dcp.go

View workflow job for this annotation

GitHub Actions / build

appendAssign: append result not assigned to the same slice (gocritic)
}

func (s *dcp) SetEventHandler(eventHandler models.EventHandler) {
Expand Down Expand Up @@ -206,9 +206,11 @@ func (s *dcp) Close() {
}

func (s *dcp) unregisterMetricCollectors() {
for _, collector := range s.metricCollectors {
prometheus.DefaultRegisterer.Unregister(collector)
for i := range s.metricCollectors {
prometheus.DefaultRegisterer.Unregister(s.metricCollectors[i])
}

s.metricCollectors = []prometheus.Collector{}
}

func (s *dcp) Commit() {
Expand Down

0 comments on commit f950a6a

Please sign in to comment.