Motivation
The Slack, Discord and Microsoft Teams notifiers render each changed field with render.Render, which prints Go internals rather than values. A rule added through a flag file currently arrives in Slack as:
Rules: nil => (*[]flag.Rule){flag.Rule{Name:(*string)("Test Rule"), Query:(*string)("biddableId eq \"123903\""), VariationResult:(*string)("on"), Percentages:(*map[string]float64)(nil), ProgressiveRollout:(*flag.ProgressiveRollout)(nil), Disable:(*bool)(nil)}}
Dates are worse, since time.Time is printed as its internal fields ({wall:0, ext:63926787600, loc:...}).
Separately, the three notifiers only keep changes of type update, so a field that is added or removed is silently dropped. Adding a new metadata key or a new variation produces a "Flag updated" message with no details.
Requirements
- Render changed values as JSON, using the existing
json tags on the flag structs, so pointers and time internals disappear:
Rules: null => [{"name":"Test Rule","query":"biddableId eq \"123903\"","variation":"on"}]
Experimentation: null => {"start":"2026-10-05T09:00:00Z","end":"2026-10-12T09:00:00Z"}
Disable: null => true
- Fall back to the current rendering for any value JSON cannot encode.
- Include fields that were added or removed, not only updated ones.
- Share one implementation across the Slack, Discord and Teams notifiers.
- No new dependency and no configuration change. Message layout and field paths stay as they are.
I have a PR ready for this and am happy to adjust it.
Motivation
The Slack, Discord and Microsoft Teams notifiers render each changed field with
render.Render, which prints Go internals rather than values. A rule added through a flag file currently arrives in Slack as:Dates are worse, since
time.Timeis printed as its internal fields ({wall:0, ext:63926787600, loc:...}).Separately, the three notifiers only keep changes of type
update, so a field that is added or removed is silently dropped. Adding a new metadata key or a new variation produces a "Flag updated" message with no details.Requirements
jsontags on the flag structs, so pointers and time internals disappear:I have a PR ready for this and am happy to adjust it.