mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-12 10:04:29 +02:00
Rename local var new to not collide with builtin (#1610)
* Rename local var new to not collide with builtin * Add missed var rename
This commit is contained in:
parent
13938ab5a8
commit
841d2a5885
@ -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
|
||||
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user