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
ref: Use a Context type mapping to map[string]interface{} #444
Changes from 6 commits
ffc9a42
d2a7c9a
ca44f37
3196641
f555dc7
7955db6
e45a444
7bb610c
7849dca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
repos: | ||
- repo: https://github.com/dnephin/pre-commit-golang | ||
rev: 96221dc741cb30cc0136999083dc6bd0e2113000 | ||
hooks: | ||
- id: go-build | ||
- id: go-fmt | ||
- id: go-imports | ||
- id: golangci-lint | ||
- id: no-go-testing | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,10 +161,12 @@ type Exception struct { | |
// An EventID must be 32 characters long, lowercase and not have any dashes. | ||
type EventID string | ||
|
||
type Context map[string]interface{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we should introduce a concrete There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I defined a new type since you mention on Slack it was a v0 and we should strive to make the API as it should. The type alias works too and the difference is minimal so that'll works well too. |
||
|
||
// Event is the fundamental data structure that is sent to Sentry. | ||
type Event struct { | ||
Breadcrumbs []*Breadcrumb `json:"breadcrumbs,omitempty"` | ||
Contexts map[string]interface{} `json:"contexts,omitempty"` | ||
Contexts map[string]Context `json:"contexts,omitempty"` | ||
Dist string `json:"dist,omitempty"` | ||
Environment string `json:"environment,omitempty"` | ||
EventID EventID `json:"event_id,omitempty"` | ||
|
@@ -286,7 +288,7 @@ func (e *Event) transactionMarshalJSON() ([]byte, error) { | |
// NewEvent creates a new Event. | ||
func NewEvent() *Event { | ||
event := Event{ | ||
Contexts: make(map[string]interface{}), | ||
Contexts: make(map[string]Context), | ||
Extra: make(map[string]interface{}), | ||
Tags: make(map[string]string), | ||
Modules: make(map[string]string), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to a separate PR?