Repository navigation
fix: use %v instead of %w in logrus error messages - #1377
Open
ogulcanaydogan wants to merge 1 commit into
Open
ogulcanaydogan wants to merge 1 commit into
ogulcanaydogan wants to merge 1 commit into
Conversation
%w is only valid for fmt.Errorf. The two logrus Errorf calls that used it (the credential helper trace and the HTTP transport trace) went through Sprintf, so the debug output contained "%!w(*errors.errorString=...)" instead of the error message. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@gmail.com>
ogulcanaydogan
requested review from
NiazFK,
gokarnm,
priteshbandi,
rgnote,
shizhMSFT,
toddysm,
vaninrao10 and
yizha1
as code owners
October 25, 2026 18:02
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1377 +/- ##
==========================================
+ Coverage 80.10% 80.20% +0.09%
==========================================
Files 68 68
Lines 3076 3076
==========================================
+ Hits 2464 2467 +3
+ Misses 403 399 -4
- Partials 209 210 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1376.
%wis only valid forfmt.Errorf. Two logrusErrorfcalls used it (cmd/notation/internal/flag/options.gofor the credential helper trace andinternal/trace/transport.gofor the HTTP transport trace), so the--debugoutput contained%!w(*errors.errorString=...)instead of the error message. This changes both to%v.Tests:
TestWithExecutableTrace_ExecuteDoneLogsErrorandTestTransport_RoundTrip_LogsResponseErrorcapture the logger output and check that it contains the error message and no formatting error. Both fail without the change.