Review the pull request and provide structured feedback.
How to fetch the PR
If given a PR number or URL, use gh pr diff <number> to get the diff and gh pr view <number> to get the description. Read any referenced issues for context.
Review structure
Return feedback in this order:
- Summary — one paragraph: what the PR does, why it exists, whether the approach is sound.
- Must fix — blocking issues; the PR should not merge until these are resolved.
- Should fix — non-blocking but important (correctness risks, API design concerns, missing tests).
- Nits — style, naming, minor clarity improvements. Prefix each with
nit:. - Verdict — one of:
Approve,Request changes, orNeeds discussion.
If a section has no items, omit it.
Checklist
Work through each category before writing the review.
Correctness
- Does the logic handle error cases? Are errors returned (not swallowed with
_)? - Are all
Rows,Batch, andConnvalues closed on every code path, including error paths? - Are there data races? Does any shared state lack synchronisation?
- Does the
Batchlifecycle (Append→SendorAbort) hold on every path? - Is
context.Contextpropagated correctly (first param, never stored in a struct)?
API design — easy to use correctly, hard to use incorrectly
- Can a caller misuse the new API without the compiler or runtime catching it?
- Does the change silently break any existing callers? Prefer deprecation over removal.
- Are new exported types/functions/methods necessary? Could this be done with existing primitives?
- Do new interfaces belong at the point of consumption, not implementation?
- Is the zero value of any new struct useful or at least safe?
Go idioms
- Error strings: lowercase, no trailing punctuation.
- Acronyms in names:
URL,HTTP,ID— notUrl,Http,Id. - Receiver names: short abbreviation, never
selforthis. - No
context.Contextstored in struct fields. - No
panicoutside ofinit()-style invariant checks. - Imports: stdlib → external → internal, blank line between groups.
- New types that contain a mutex are not copied by value.
-
mixedCapsfor unexported constants, notALL_CAPS.
Tests
- Is there a test that would have caught the bug being fixed?
- Bug fixes: is there a regression test in
tests/issues/issue_<N>_test.go? - New ClickHouse type support: column implementation + round-trip test + example?
- Do test failure messages say what was wrong, what input triggered it, and what was expected vs. got?
- Are tests table-driven where there are multiple cases?
- No test mocking of
driver.Connordriver.Rowsfor integrations tests inside root/tests/— use a real ClickHouse via testcontainers. - Make sure tests are covered for both TCP and HTTP protocol cases.
- Make sure tests are covered for both
clickhouse_native(Open() api returns) api andstdapi (OpenDB() api returns).
Performance & protocol
- Does the change avoid unnecessary allocations in hot paths (encoding/decoding columns)?
- Are new
Optionsfields safe to ignore when unset (i.e., the zero value is the sensible default)? - Does the change affect both the native TCP and HTTP protocol paths? If so, are both covered?
Documentation
- Are new exported symbols documented with a full-sentence doc comment beginning with the symbol name?
- ClickHouse SQL types and function names wrapped in backticks in any prose.
- Make sure existing docs and examples are updated.
- Make sure new docs and examples are added if needed for new features or bug fixes.
- Make sure the docs are covered for both TCP and HTTP protocol cases.
- Make sure the docs are covered for both
clickhouse_native(Open() api returns) api andstdapi (OpenDB() api returns). - If a comment or doc comment includes usage examples (e.g. inline code blocks), it is acceptable to omit error checking. Do not flag missing error handling in example code.
Source: ClickHouse/clickhouse-go — distributed by TomeVault.