diff --git a/integrations.go b/integrations.go index 046ef0a0e..4d76bef61 100644 --- a/integrations.go +++ b/integrations.go @@ -27,7 +27,7 @@ func (mi *modulesIntegration) SetupOnce(client *Client) { client.AddEventProcessor(mi.processor) } -func (mi *modulesIntegration) processor(event *Event, hint *EventHint) *Event { +func (mi *modulesIntegration) processor(event *Event, _ *EventHint) *Event { if len(event.Modules) == 0 { mi.once.Do(func() { info, ok := debug.ReadBuildInfo() @@ -70,7 +70,7 @@ func (ei *environmentIntegration) SetupOnce(client *Client) { client.AddEventProcessor(ei.processor) } -func (ei *environmentIntegration) processor(event *Event, hint *EventHint) *Event { +func (ei *environmentIntegration) processor(event *Event, _ *EventHint) *Event { // Initialize maps as necessary. contextNames := []string{"device", "os", "runtime"} if event.Contexts == nil { @@ -135,7 +135,7 @@ func (iei *ignoreErrorsIntegration) SetupOnce(client *Client) { client.AddEventProcessor(iei.processor) } -func (iei *ignoreErrorsIntegration) processor(event *Event, hint *EventHint) *Event { +func (iei *ignoreErrorsIntegration) processor(event *Event, _ *EventHint) *Event { suspects := getIgnoreErrorsSuspects(event) for _, suspect := range suspects { @@ -195,7 +195,7 @@ func (iei *ignoreTransactionsIntegration) SetupOnce(client *Client) { client.AddEventProcessor(iei.processor) } -func (iei *ignoreTransactionsIntegration) processor(event *Event, hint *EventHint) *Event { +func (iei *ignoreTransactionsIntegration) processor(event *Event, _ *EventHint) *Event { suspect := event.Transaction if suspect == "" { return event @@ -233,7 +233,7 @@ func (cfi *contextifyFramesIntegration) SetupOnce(client *Client) { client.AddEventProcessor(cfi.processor) } -func (cfi *contextifyFramesIntegration) processor(event *Event, hint *EventHint) *Event { +func (cfi *contextifyFramesIntegration) processor(event *Event, _ *EventHint) *Event { // Range over all exceptions for _, ex := range event.Exception { // If it has no stacktrace, just bail out @@ -353,7 +353,7 @@ func (ti *globalTagsIntegration) SetupOnce(client *Client) { client.AddEventProcessor(ti.processor) } -func (ti *globalTagsIntegration) processor(event *Event, hint *EventHint) *Event { +func (ti *globalTagsIntegration) processor(event *Event, _ *EventHint) *Event { if len(ti.tags) == 0 && len(ti.envTags) == 0 { return event } diff --git a/internal/testutils/asserts.go b/internal/testutils/asserts.go index 405901683..5d8be7120 100644 --- a/internal/testutils/asserts.go +++ b/internal/testutils/asserts.go @@ -74,7 +74,7 @@ func formatUnequalValues(got, want interface{}) string { return fmt.Sprintf("\ngot: %s\nwant: %s", a, b) } -func AssertBaggageStringsEqual(t *testing.T, got, want string, userMessage ...interface{}) { +func AssertBaggageStringsEqual(t *testing.T, got, want string) { t.Helper() baggageGot, err := baggage.Parse(got) diff --git a/martini/sentrymartini.go b/martini/sentrymartini.go index 425289fd0..5db83345c 100644 --- a/martini/sentrymartini.go +++ b/martini/sentrymartini.go @@ -44,7 +44,7 @@ func New(options Options) martini.Handler { }).handle } -func (h *handler) handle(rw http.ResponseWriter, r *http.Request, ctx martini.Context) { +func (h *handler) handle(_ http.ResponseWriter, r *http.Request, ctx martini.Context) { hub := sentry.GetHubFromContext(r.Context()) if hub == nil { hub = sentry.CurrentHub().Clone() diff --git a/mocks_test.go b/mocks_test.go index d63aa14e2..a87bd3f4b 100644 --- a/mocks_test.go +++ b/mocks_test.go @@ -10,11 +10,11 @@ type ScopeMock struct { shouldDropEvent bool } -func (scope *ScopeMock) AddBreadcrumb(breadcrumb *Breadcrumb, limit int) { +func (scope *ScopeMock) AddBreadcrumb(breadcrumb *Breadcrumb, _ int) { scope.breadcrumb = breadcrumb } -func (scope *ScopeMock) ApplyToEvent(event *Event, hint *EventHint) *Event { +func (scope *ScopeMock) ApplyToEvent(event *Event, _ *EventHint) *Event { if scope.shouldDropEvent { return nil } @@ -27,14 +27,14 @@ type TransportMock struct { lastEvent *Event } -func (t *TransportMock) Configure(options ClientOptions) {} +func (t *TransportMock) Configure(_ ClientOptions) {} func (t *TransportMock) SendEvent(event *Event) { t.mu.Lock() defer t.mu.Unlock() t.events = append(t.events, event) t.lastEvent = event } -func (t *TransportMock) Flush(timeout time.Duration) bool { +func (t *TransportMock) Flush(_ time.Duration) bool { return true } func (t *TransportMock) Events() []*Event { diff --git a/scope_concurrency_test.go b/scope_concurrency_test.go index d4e56d49c..ec9a313d6 100644 --- a/scope_concurrency_test.go +++ b/scope_concurrency_test.go @@ -9,7 +9,7 @@ import ( "github.com/getsentry/sentry-go" ) -func TestConcurrentScopeUsage(t *testing.T) { +func TestConcurrentScopeUsage(_ *testing.T) { var wg sync.WaitGroup for i := 0; i < 10; i++ { diff --git a/tracing_test.go b/tracing_test.go index 2ca01c75d..dcced2c34 100644 --- a/tracing_test.go +++ b/tracing_test.go @@ -587,7 +587,7 @@ func TestContinueSpanFromTrace(t *testing.T) { } } -func TestSpanFromContext(t *testing.T) { +func TestSpanFromContext(_ *testing.T) { // SpanFromContext always returns a non-nil value, such that you can use // it without nil checks. // When no span was in the context, the returned value is a no-op. @@ -697,7 +697,7 @@ func TestSample(t *testing.T) { } } -func TestDoesNotCrashWithEmptyContext(t *testing.T) { +func TestDoesNotCrashWithEmptyContext(_ *testing.T) { // This test makes sure that we can still start and finish transactions // with empty context (for example, when Sentry SDK is not initialized) ctx := context.Background() @@ -884,7 +884,7 @@ func TestSpanSetContextOverrides(t *testing.T) { // This test checks that there are no concurrent reads/writes to // substructures in scope.contexts. // See https://github.com/getsentry/sentry-go/issues/570 for more details. -func TestConcurrentContextAccess(t *testing.T) { +func TestConcurrentContextAccess(_ *testing.T) { ctx := NewTestContext(ClientOptions{ EnableTracing: true, TracesSampleRate: 1, @@ -973,7 +973,7 @@ func TestAdjustingTransactionSourceBeforeSending(t *testing.T) { // This is a regression test for https://github.com/getsentry/sentry-go/issues/587 // Without the "spans can be finished only once" fix, this test will fail // when run with race detection ("-race"). -func TestSpanFinishConcurrentlyWithoutRaces(t *testing.T) { +func TestSpanFinishConcurrentlyWithoutRaces(_ *testing.T) { ctx := NewTestContext(ClientOptions{ EnableTracing: true, TracesSampleRate: 1,