Thanks for helping with ant. Bug reports, fixes and docs are all welcome. For a new feature, open an issue first so we can agree on the shape before you write it.
ant uses GitHub Flow. main is always releasable, and every change reaches it through a pull request.
-
Branch off the latest
main:git switch main git pull origin main git switch -c feat/short-name # or fix/short-name -
Push the branch and open a pull request into
main. -
CI must pass (
lintandtest), and one maintainer must approve. -
The pull request is squash-merged, so its title becomes the commit on
main.
main only accepts a linear history, so a branch that has fallen behind must be rebased, never merged:
git pull --rebase origin main
# fix any conflicts, then git add <files> and git rebase --continue
git push --force-with-leaseDon't merge main into your branch. Rebasing keeps the branch linear, so each commit can be reviewed on its own.
Use Conventional Commits. The pull request title matters most, because it becomes the squashed commit:
feat: add ChunkByKey for composite keys
fix(mysql): quote reserved column names in upserts
docs: explain Include ordering
Types: feat, fix, docs, test, refactor, perf, ci, chore. Add ! after the type for a breaking change, as in feat!: rename Session options.
You need Go 1.27 or later, Docker, make and staticcheck. CI runs the same make targets.
make build # build every module
make fmt # lay out the code; lint fails on anything this would change
make lint # go vet, antvet, staticcheck and golangci-lint
make test # unit tests of every module; database tests skip
make test-modules # just the nested modules (tools/*, contrib/otel)
make tidy # go mod tidy in every module
make deps # govulncheck, and a list of outdated dependencies
make db-up DATABASES=postgres # start PostgreSQL in Docker
make test-pg # API tests and feature examples on PostgreSQL
make db-down # stop the databases and discard their datamake test skips every database test unless ANT_TEST_DATABASES is set, so a green run without a database proves little. For anything that reaches SQL, run make test-pg. If you touch another dialect, also run test-mysql, test-mariadb, test-sqlite or test-mssql (start them with make db-up, or leave DATABASES out to start all five). CI also runs the tests against PostgreSQL under the race detector, which needs cgo, except the value probes under tests/features/value_handling/probes, which start no goroutines and run on a runner of their own.
Database tests run in parallel, eight at a time per package (PARALLEL=8). Each test gets a database of its own: a temporary file on SQLite, a schema on PostgreSQL, and a database on MySQL, MariaDB and SQL Server, so their users need the right to create databases (the defaults connect as root and sa). A test that changes something the whole process shares, such as an environment variable, slog's default logger, secure.SetKeys, WithNaming or WithConvention, calls testdb.Serial(t) (fixture.Serial(t) in tests/features) before it reaches the database. Go runs those first, one at a time, then the parallel ones.
- A test that fails without it. New features also get a short example under
tests/features/. - If the exported API changes on purpose, rewrite the record with
go test ./tests/api -updateand say so in the pull request. - Design decisions go in
docs/decisions/, a file each, andgo test ./tests/docs -updaterewrites their index. - A change to SQL, scanning, types, quoting, paging or transactions has to hold on all five databases.
docs/databases.mdlists what each one supports. - User docs live in ant-docs. Update them there when behaviour changes.
- The skill for coding agents,
skills/ant/SKILL.md, states the API's rules in brief. Update it when a change makes it wrong.tests/apifails if it names something the API no longer has. To type-check its samples, run ant-docs' doccheck on it, fromant-docs/tools/doccheckwith ago.workthat points at your ant checkout:go run ./cmd/doccheck ../../../ant/skills.
A tag vX.Y.Z on main releases ant: the release workflow drafts the GitHub release and asks the module proxy for the version. The nested modules are released with tags of their own, contrib/otel/vX.Y.Z, tools/antvet/vX.Y.Z and tools/antfmt/vX.Y.Z. A program that adds contrib/otel ignores its replace directive, so the ant it requires must be a release:
- Tag and push ant's
vX.Y.Z. - In a pull request, set the
github.com/skudra-go/antrequire ofcontrib/otel/go.modtovX.Y.Z(thereplacestays, for working in this repository), and run its tests. - Once that is merged, tag and push
contrib/otel/vX.Y.Zon it. The workflow refuses a nested tag whosego.modrequires a version that is not a release.tools/antvetandtools/antfmtdo not import ant, so they can be tagged at once.
Everyone taking part follows the code of conduct. Report vulnerabilities privately, as SECURITY.md describes, not in an issue.