Skip to content

Commit

Permalink
Rename local var new to not collide with builtin (open-telemetry#1610)
Browse files Browse the repository at this point in the history
* Rename local var new to not collide with builtin

* Add missed var rename
  • Loading branch information
MrAlias authored and ldelossa committed Mar 5, 2021
1 parent 32745a7 commit 5b85dd9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sdk/trace/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ func (p *TracerProvider) RegisterSpanProcessor(s SpanProcessor) {
func (p *TracerProvider) UnregisterSpanProcessor(s SpanProcessor) {
p.mu.Lock()
defer p.mu.Unlock()
new := spanProcessorStates{}
spss := spanProcessorStates{}
old, ok := p.spanProcessors.Load().(spanProcessorStates)
if !ok || len(old) == 0 {
return
}
new = append(new, old...)
spss = append(spss, old...)

// stop the span processor if it is started and remove it from the list
var stopOnce *spanProcessorState
var idx int
for i, sps := range new {
for i, sps := range spss {
if sps.sp == s {
stopOnce = sps
idx = i
Expand All @@ -153,13 +153,13 @@ func (p *TracerProvider) UnregisterSpanProcessor(s SpanProcessor) {
}
})
}
if len(new) > 1 {
copy(new[idx:], new[idx+1:])
if len(spss) > 1 {
copy(spss[idx:], spss[idx+1:])
}
new[len(new)-1] = nil
new = new[:len(new)-1]
spss[len(spss)-1] = nil
spss = spss[:len(spss)-1]

p.spanProcessors.Store(new)
p.spanProcessors.Store(spss)
}

// ApplyConfig changes the configuration of the provider.
Expand Down

0 comments on commit 5b85dd9

Please sign in to comment.