Skip to content

Look up Stringer context values using the original key - #152

Open
vitalivo wants to merge 1 commit into
samber:mainfrom
vitalivo:fix/stringer-context-key
Open

Look up Stringer context values using the original key#152
vitalivo wants to merge 1 commit into
samber:mainfrom
vitalivo:fix/stringer-context-key

Conversation

@vitalivo

Copy link
Copy Markdown

WithContext formats a fmt.Stringer key before passing it to context.Value, changing its identity. A typed key then returns nil, or a different value stored under its string representation. Use the original key for lookup and its string form only as the output field name.

The regression deliberately stores both keys with different values and fails before the fix. Full Go race tests (95.0% coverage), vet, and golangci-lint pass. Tests run from a path containing github.com/samber/oops, as required by the stacktrace tests and CI.

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.

1 participant