Artifact 5023d136fb5f0c1fd1136ffb502e1913827661fe519e9c4386344e55c95ec8f4:
- File
CONTRIBUTING.md
— part of check-in
[6273a0750d]
at
2026-07-22 23:03:24
on branch trunk
— fix: correct go.mod module path to go-libfossil (#76) (#117)
* fix: correct go.mod module path to go-libfossil (#76)
The module directive still declared github.com/danmestas/libfossil after the repository was renamed to go-libfossil. pkg.go.dev/godoc scraping matches the declared module path against its hosting path, so the stale path broke SDK doc generation.
Rename the module path across all four in-repo modules (root, the two db/driver submodules, observer/otel, and docs/site) and every internal import, plus the release workflow, the doc-generation script, and the docs.
No tag has been published under the go-libfossil path yet, so the cross-module requires cannot resolve from the proxy. Add replace directives pointing the in-repo requires at their local directories so GOWORK=off builds and the CI matrix resolve without a published version. These replaces are ignored by downstream consumers and can be dropped once new-path tags are cut.
* Guard releases against replace directives; regenerate SDK docs
The go-libfossil rename bridges the in-repo modules with `replace` directives. Go refuses a main module that carries them, so a tag cut while they are present breaks `go install .../cmd/libfossil@<tag>` and every `@version` fetch of the driver submodules. Add a Release workflow step that fails the job before anything is published if any tracked go.mod still contains a replace directive, so the bridge is a CI-enforced TODO rather than a silent landmine. The step comment records what unblocks a release: re-tag the submodules with the corrected module paths, bump the root requires, then drop the replace blocks.
Regenerate the SDK reference docs. The previous pass only substituted URLs over the pre-existing generated files, leaving stale signatures (Repo.Timeline was still documented as taking LogOpts rather than TimelineOpts). Note that gomarkdoc must be run outside a git worktree — inside one it silently strips every source link.
Also reword the README rename note, which read as though the import path had not changed, and re-sort the ncruces require block. (user: [email protected], size: 3589) [annotate] [blame] [check-ins using]
# Contributing to libfossil Thanks for your interest in `libfossil`, a pure-Go implementation of Fossil SCM. This document covers everything you need to get a working checkout, run the tests, and submit changes. ## Development setup Requires Go 1.26 or newer. ``` git clone https://github.com/danmestas/go-libfossil cd libfossil make setup-hooks ``` The repository ships with a `go.work` file at the root, so the main module and the submodules (`db/driver/modernc`, `db/driver/ncruces`, `observer/otel`) resolve each other locally without any extra configuration. `make setup-hooks` points `core.hooksPath` at `.githooks/` so the pre-commit hook runs on every commit. The hook runs both SQLite drivers, `go vet`, the OTel submodule, and the CLI build in roughly 45 seconds; skip it with `--no-verify` only in emergencies. ## Running tests The main targets are: - `make test` runs `go test ./...` against the default `modernc` SQLite driver. - `make test-drivers` runs the full suite twice: once with `modernc` and once with `ncruces` via `go test -tags test_ncruces ./...`. Any change that touches the database layer should pass both. - `make test-otel` runs the OTel observer submodule in isolation with `GOWORK=off` so it resolves against its own `go.mod` rather than the workspace. - `make test-all` chains `test-drivers`, `test-otel`, and the CLI build. This is the target CI uses and the one to run before opening a pull request. Deterministic simulation tests live under `./dst/...`. They are not excluded from the default run but are slow - roughly a minute per driver - so expect `make test-drivers` to take a few minutes end to end. ## Code layout - Root module (`github.com/danmestas/go-libfossil`) holds the public API: `Repo`, checkout, sync, merge, and history helpers. See `fossil.go`, `repo.go`, and the `repo_*.go` files. - `cli/` hosts the Kong-based command-line surface; the `libfossil` binary is assembled in `cmd/libfossil/`. - `internal/` contains the implementation packages that back the public API - `sync`, `merge`, `checkout`, `manifest`, `content`, and friends. These are not part of the stable surface. - `db/` is the SQLite abstraction plus two driver submodules: `db/driver/modernc` (the default, pure-Go) and `db/driver/ncruces` (WASM-based, selected with the `test_ncruces` build tag). - `observer/otel/` is a separate Go module providing an optional OpenTelemetry observer; it lives out of the workspace path so apps can take it as a narrow dependency. - `dst/` contains the deterministic simulation test harness and scenarios. ## Submitting changes Keep pull requests small and focused on a single change. Before opening one: - Make sure the pre-commit hook passes (equivalent to `make test-all`). - If your change touches the database layer, verify it runs under both the `modernc` and `ncruces` drivers. - New behavior needs tests. Bug fixes should include a regression test that fails without the fix. - If you are touching fault-sensitive code (sync, merge, checkout, or anything that writes to disk), consider whether a BUGGIFY site is appropriate so DST can exercise the new path. See `docs/testing.md` for the conventions. Commit messages should explain the "why" as well as the "what". Reference issue numbers where relevant. ## Reporting issues Please open issues on GitHub. Include your Go version (`go version`), operating system, and minimal reproduction steps. If a specific `.fossil` repository triggers the bug and it is not sensitive, attach a sample - it speeds up triage considerably.