zapcore: fix CheckWriteHook godoc example signature#1545
Closed
Bojun-Vvibe wants to merge 1 commit intouber-go:masterfrom
Closed
zapcore: fix CheckWriteHook godoc example signature#1545Bojun-Vvibe wants to merge 1 commit intouber-go:masterfrom
Bojun-Vvibe wants to merge 1 commit intouber-go:masterfrom
Conversation
The example in CheckWriteHook's doc comment showed ce.After(hook) but After's actual signature is After(ent Entry, hook CheckWriteHook).
|
|
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.
Repo: uber-go/zap (⭐ 22000)
Type: docs
Files changed: 1
Lines: +1/-1
What
Fixes the example in the
CheckWriteHookdoc comment inzapcore/entry.go. The example showedce = ce.After(hook)but the actual(*CheckedEntry).Aftermethod signature requires anEntryargument first:After(ent Entry, hook CheckWriteHook). The example now matches the real API.Why
Godoc examples are the first thing users see when integrating with a public API. Showing a call that won't compile is misleading and erodes trust in the documentation. All other call sites in the package (including tests at
zapcore/entry_test.go:114-137) use the two-argument form.Testing
Pure documentation change inside a comment block, no behavior affected. Verified the corrected example matches the actual
Aftersignature atzapcore/entry.go:331and the usage pattern inentry_test.go.Risk
Low — comment-only change.