From 90739033ffa60957810b2ef3d850a144901a54dc Mon Sep 17 00:00:00 2001 From: Michael Brooks Date: Tue, 20 Oct 2026 11:02:36 -0600 Subject: [PATCH] refactor: remove unused OpenTracingSpan function --- internal/slackcontext/slackcontext.go | 11 ---------- internal/slackcontext/slackcontext_test.go | 25 ---------------------- 2 files changed, 36 deletions(-) diff --git a/internal/slackcontext/slackcontext.go b/internal/slackcontext/slackcontext.go index 1e277e0e..fb8ee082 100644 --- a/internal/slackcontext/slackcontext.go +++ b/internal/slackcontext/slackcontext.go @@ -47,17 +47,6 @@ const ( contextKeyVersion ) -// OpenTracingSpan returns the `opentracing.Span“ associated with `ctx`, or -// `nil` and `slackerror.ErrContextValueNotFound` if no `Span` could be found. -func OpenTracingSpan(ctx context.Context) (opentracing.Span, error) { - span := opentracing.SpanFromContext(ctx) - if span == nil { - return nil, slackerror.New(slackerror.ErrContextValueNotFound). - WithMessage("The value for OpenTracing Span could not be found") - } - return span, nil -} - // SetOpenTracingSpan returns a new `context.Context` that holds a reference to // the span. If span is nil, a new context without an active span is returned. func SetOpenTracingSpan(ctx context.Context, span opentracing.Span) context.Context { diff --git a/internal/slackcontext/slackcontext_test.go b/internal/slackcontext/slackcontext_test.go index f011f7c9..362a85b5 100644 --- a/internal/slackcontext/slackcontext_test.go +++ b/internal/slackcontext/slackcontext_test.go @@ -26,31 +26,6 @@ import ( "github.com/stretchr/testify/require" ) -func Test_SlackContext_OpenTracingSpan(t *testing.T) { - tests := map[string]struct { - expectedSpan opentracing.Span - expectedError error - }{ - "returns span when span exists": { - expectedSpan: opentracing.StartSpan("test.span"), - expectedError: nil, - }, - "returns error when span not found": { - expectedSpan: nil, - expectedError: slackerror.New(slackerror.ErrContextValueNotFound).WithMessage("The value for OpenTracing Span could not be found"), - }, - } - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - ctx := t.Context() - ctx = opentracing.ContextWithSpan(ctx, tc.expectedSpan) - actualSpan, actualError := OpenTracingSpan(ctx) - require.Equal(t, tc.expectedSpan, actualSpan) - require.Equal(t, tc.expectedError, actualError) - }) - } -} - func Test_SlackContext_SetOpenTracingSpan(t *testing.T) { tests := map[string]struct { expectedSpan opentracing.Span