Skip to content

Conversation

@pohly
Copy link
Contributor

@pohly pohly commented Dec 4, 2023

The invalid initialization of the sink field in the WithGroup method was found by @thockin during code reading.

This PR adds unit testing that fails without that fix.

This turns testLogSink into an implementation of SlogSink if slog is supported, then runs through some scenarios where values get added using different APIs. The end result gets compared by formatting with the slog JSON handler because that is easier than writing custom code for a deep-equal comparison of slog attributes. The "with-group-and-logr-values" is the case which was broken.
@pohly pohly force-pushed the withgroup-sink-fix branch from 5572aef to ffd51a4 Compare December 4, 2023 13:51
@thockin thockin merged commit 5153ab2 into go-logr:master Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants