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

Update slogtest empty-group-record explanation #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arthurbdiniz
Copy link

@arthurbdiniz arthurbdiniz commented Jan 17, 2025

The commit https://go.dev/cl/516155 changed the explanation regarding empty group handling, causing TestSlogHandler to fail.

This Pull Request updates the corresponding test message:

  • Replaced "a Handler should not output groups for an empty Record"
  • With "a Handler should not output groups if there are no attributes".

https://cs.opensource.google/go/go/+/master:src/testing/slogtest/slogtest.go;l=161

This aligns the test with the new behavior and ensures it passes.

"a Handler should ignore a zero Record.Time", // zapr always writes a time field.
"a Handler should not output groups for an empty Record", // Relies on WithGroup and that always opens a group. Text may change, see https://go.dev/cl/516155
"a Handler should ignore a zero Record.Time", // zapr always writes a time field.
"a Handler should not output groups if there are no attributes", // Relies on WithGroup and that always opens a group.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might have to keep the old string to avoid errors when using an old Go version.

That aside, golang/go#61758 probably got merged long enough ago that we can skip unsupported sub-tests as outlined in golang/go#65400 (comment).

Can you give that a try instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants