1
0
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:
Tyler Yahn 2021-03-03 16:26:26 +00:00 committed by GitHub
parent 13938ab5a8
commit 841d2a5885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.