Problem
cockroachdb/errors v1.12.0 (and current master, commit 64801262) fails to typecheck when built against getsentry/sentry-go >= v0.46.0.
The root cause is a single line in report/report.go:369:
event.Extra[extraKey] = extraValue
sentry-go v0.46.0 (CHANGELOG, PR #1274) removed the Extra field from sentry.Event as a breaking change. cockroachdb/errors does not declare an upper bound on the sentry-go version, so any transitive upgrade propagates the compile error to every downstream consumer.
Repro
// go.mod
require (
github.com/cockroachdb/errors v1.12.0
github.com/getsentry/sentry-go v0.46.0
)
// main.go
package main
import "github.com/cockroachdb/errors"
func main() {
_ = errors.New("x")
}
$ go build ./...
.../cockroachdb/errors@v1.12.0/report/report.go:369:9:
event.Extra undefined (type *sentry.Event has no field or method Extra)
Blast radius
Because report_api.go in the root errors package imports the report sub-package, the typecheck failure blocks the entire module — not just the Sentry-reporting code path. Any project that imports github.com/cockroachdb/errors (directly or transitively) cannot build once sentry-go reaches v0.46.0.
Suggested fix
In report/report.go ReportError, replace the event.Extra write with the post-v0.46 equivalent. Options:
-
Use Contexts (the replacement for per-event unstructured data):
if event.Contexts == nil {
event.Contexts = map[string]sentry.Context{}
}
event.Contexts[extraKey] = sentry.Context{"value": extraValue}
-
Or, since BuildSentryReport already returns extraDetails as a separate map, drop the in-place merge inside ReportError and let callers attach extras via scope.SetContext (which is how sentry-go intends extras to be propagated in v0.46+).
Either approach should be scoped to report/report.go only — no other file in the module touches Event.Extra.
Related
Thanks for the library!
Problem
cockroachdb/errorsv1.12.0 (and currentmaster, commit64801262) fails to typecheck when built againstgetsentry/sentry-go>= v0.46.0.The root cause is a single line in
report/report.go:369:sentry-gov0.46.0 (CHANGELOG, PR #1274) removed theExtrafield fromsentry.Eventas a breaking change.cockroachdb/errorsdoes not declare an upper bound on thesentry-goversion, so any transitive upgrade propagates the compile error to every downstream consumer.Repro
Blast radius
Because
report_api.goin the rooterrorspackage imports thereportsub-package, the typecheck failure blocks the entire module — not just the Sentry-reporting code path. Any project that importsgithub.com/cockroachdb/errors(directly or transitively) cannot build oncesentry-goreaches v0.46.0.Suggested fix
In
report/report.goReportError, replace theevent.Extrawrite with the post-v0.46 equivalent. Options:Use
Contexts(the replacement for per-event unstructured data):Or, since
BuildSentryReportalready returnsextraDetailsas a separate map, drop the in-place merge insideReportErrorand let callers attach extras viascope.SetContext(which is howsentry-gointends extras to be propagated in v0.46+).Either approach should be scoped to
report/report.goonly — no other file in the module touchesEvent.Extra.Related
Thanks for the library!