Skip to content

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

Merged
samber merged 1 commit into
samber:mainfrom
vitalivo:fix/stringer-context-key
Sep 14, 2026
Merged

samber merged 1 commit into
samber:mainfrom
vitalivo:fix/stringer-context-key

Conversation

@vitalivo

Copy link
Copy Markdown
Contributor

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.

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.52%. Comparing base (525f106) to head (76fb365).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
+ Coverage   91.20%   91.52%   +0.31%     
==========================================
  Files          15       15              
  Lines        1251     1251              
==========================================
+ Hits         1141     1145       +4     
+ Misses         88       84       -4     
  Partials       22       22              
Flag Coverage Δ
unittests 91.52% <100.00%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samber
samber merged commit 5fcade6 into samber:main Sep 14, 2026
16 of 17 checks passed
@samber

samber commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix!

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