-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When a span is created inside a block (if, for, etc), the record-error check will complain about return
statements outside that block.
To Reproduce
Below, the span
variable does not exist outside the if
block. The return
statement does not occur "inside" this span.
package main
import (
"context"
"errors"
"go.opentelemetry.io/otel"
)
func main() {
run(context.Background())
}
func run(ctx context.Context) error {
if true {
_, span := otel.Tracer("foo").Start(ctx, "bar")
span.End()
}
return errors.New("asdf")
}
Expected behavior
I expected no results from the record-error check, as no spans are in scope at the return
.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working