mirror of
https://github.com/hanzo-ds/go.git
synced 2026-10-30 19:45:01 +00:00
Source: the unexported clickhouse struct becomes client, the ch receiver and chproto import alias follow, error message prefixes read datastore, and the JSON serializer interface drops the vendor infix. resources' metadata key and its accessor are renamed together, with a test proving the embedded YAML still unmarshals — a silent drift there would have made every connection take the unsupported-server-version branch. Codegen: all three templates still emitted the upstream module paths, so regenerating would have quietly undone the rename. Note the templates have drifted from the files they produce (regenerating today drops QBit and scanTypeDuration), so the generated files are left as tracked and only the templates are corrected. Dead links: an earlier mechanical pass invented URLs that do not resolve — github.com/ClickHouse/datastore-go, hanzo-ds/driver issue numbers that belong to upstream, and mangled names of independent projects (mailru, uptrace, nikepan, EpicStep). Third-party names are not ours to rewrite, so those directories are removed rather than repaired, and provenance comments now point at real files. Dev infra: compose runs our own server image at the tag production runs, since the vendor's alpine tag does not exist in our registry. Cluster hostnames, nginx upstreams and server configs are renamed as one set. CHANGELOG.md is upstream's release history for versions this module never released; rewriting it would fabricate a lineage, so it is dropped and the upstream base recorded in README instead. The two long-standing vet findings are fixed by keying the struct literals rather than suppressed. LICENSE and contributors/list keep the vendor name on purpose: one is the copyright notice Apache-2.0 requires, the other is real people's names. CI now enforces build, vet, test, gofmt and a grep gate.
2.3 KiB
2.3 KiB
Contributing
Local setup
Docker is required. Start a local Datastore instance and run the full test suite:
make up # start Datastore via Docker Compose
make test # run all tests with -race
make down # stop and remove containers
Make targets
| Target | What it does |
|---|---|
make up |
Start Datastore (waits until healthy) |
make down |
Stop and remove containers |
make test |
Run the full test suite with -race and -count=1 |
make lint |
Run golangci-lint |
make staticcheck |
Run staticcheck |
make codegen |
Regenerate column implementations and update license headers |
make contributors |
Rebuild contributors/list from git log |
Running specific tests
# Run a single test
go test -race -count=1 -v ./tests/... -run TestBatchFlush
# Run against a specific Datastore version
DATASTORE_VERSION=25.3 make test
# Run only the database/sql interface tests
go test -race -count=1 -v ./tests/std/...
# Run Go benchmark tests
go test -bench=. -benchmem ./benchmark/...
# Run a standalone benchmark program (most benchmarks are standalone executables)
go run benchmark/v2/read/main.go
Writing tests
- Integration tests live in
tests/. They require a running Datastore (viamake up) and use testcontainers-go for environment setup. - Regression tests for bug fixes go in
tests/issues/named after the issue:issue_1234_test.go. Every bug fix should include one. - New Datastore type support requires three things: a column implementation in
lib/column/, a round-trip test intests/, and an example inexamples/datastore_api/. - Do not mock
driver.Connordriver.Rowsin tests — test against a real Datastore instance.
Code guidelines
See .claude/CLAUDE.md for Go idioms, API design principles, and workflow rules enforced in this repo.
Pull requests
- Open a PR against
main. All changes require a PR — do not commit directly. - Keep PRs focused. One logical change per PR.
- Ensure
make lintandmake testpass before requesting review. - Reference the GitHub issue number in the PR description if one exists.
- Do not edit
CHANGELOG.md— it is generated automatically during the release process.