Skip to content

zapcore: fix CheckWriteHook godoc example signature#1545

Closed
Bojun-Vvibe wants to merge 1 commit intouber-go:masterfrom
Bojun-Vvibe:agent/uber-go_zap-1776718459
Closed

zapcore: fix CheckWriteHook godoc example signature#1545
Bojun-Vvibe wants to merge 1 commit intouber-go:masterfrom
Bojun-Vvibe:agent/uber-go_zap-1776718459

Conversation

@Bojun-Vvibe
Copy link
Copy Markdown

Repo: uber-go/zap (⭐ 22000)
Type: docs
Files changed: 1
Lines: +1/-1

What

Fixes the example in the CheckWriteHook doc comment in zapcore/entry.go. The example showed ce = ce.After(hook) but the actual (*CheckedEntry).After method signature requires an Entry argument 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 After signature at zapcore/entry.go:331 and the usage pattern in entry_test.go.

Risk

Low — comment-only change.

The example in CheckWriteHook's doc comment showed ce.After(hook) but
After's actual signature is After(ent Entry, hook CheckWriteHook).
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Bojun-Vvibe Bojun-Vvibe closed this by deleting the head repository Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants