Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename local var new to not collide with builtin #1610

Merged
merged 4 commits into from
Mar 3, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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