Skip to content
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

utils.IterateOrderedMap for plugin.FormatMessage #186

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

oxzi
Copy link
Member

@oxzi oxzi commented Apr 24, 2024

The "Tags" and "Extra Tags" printed in the plugin.FormatMessage were directly read from their map, thus having no order. This resulted in the same NotificationRequest being represented by different messages due to the unordered map.

This change was the result of investigating Go's new rangefunc experiment. The utilization of this novel language feature - which can also be indirectly used in the absence of GOEXPERIMENT=rangefunc - ensures that the map is traversed in key order.

Closes #177.

@oxzi oxzi requested a review from julianbrost April 24, 2024 14:10
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Apr 24, 2024
internal/utils/utils_test.go Outdated Show resolved Hide resolved
internal/utils/utils_test.go Outdated Show resolved Hide resolved
@oxzi oxzi force-pushed the plugin-formatmessage-order-i177 branch from 021059a to 88286ba Compare April 25, 2024 09:57
@oxzi oxzi requested a review from julianbrost April 25, 2024 09:57
The "Tags" and "Extra Tags" printed in the plugin.FormatMessage were
directly read from their map, thus having no order. This resulted in the
same NotificationRequest being represented by different messages due to
the unordered map.

This change was the result of investigating Go's new rangefunc
experiment[0]. The utilization of this novel language feature - which can
also be indirectly used in the absence of `GOEXPERIMENT=rangefunc` - ensures
that the map is traversed in key order.

Closes #177.

[0]: https://go.dev/wiki/RangefuncExperiment
@oxzi oxzi force-pushed the plugin-formatmessage-order-i177 branch from 88286ba to 011fc75 Compare April 25, 2024 10:00
@julianbrost julianbrost merged commit e371553 into main Apr 25, 2024
12 checks passed
@julianbrost julianbrost deleted the plugin-formatmessage-order-i177 branch April 25, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugin.FormatMessage: Sort req.Object.{,Extra}Tags
2 participants