coredns/coredns
By the numbers
A snapshot of the CoreDNS codebase. Data collected on 2026-04-30 against commit 145029c84 on branch master.
Size
The repo is overwhelmingly Go, with markdown READMEs documenting each plugin and a small slice of YAML/proto for CI and the gRPC service.
xychart-beta horizontal title "Lines of code by file class" x-axis ["Go (incl. tests)", "Test Go", "Markdown docs", "YAML config", "Protobuf"] y-axis "Lines" 0 --> 200000 bar [168982, 48970, 12545, 800, 12]
| Class | Files | Lines |
|---|---|---|
| Go (all) | 666 | 168,982 |
Go tests (*_test.go) |
of which 332 | 48,970 |
| Markdown (READMEs, CONTRIBUTING, etc.) | ~85 | 12,545 |
YAML (CI workflows, .golangci.yml, etc.) |
~25 | 800 |
Protobuf (pb/dns.proto) |
1 | 12 |
| Total Go (non-test) | 334 | ~120,000 |
The test-to-code ratio is roughly 40%.
Where the Go code lives
| Directory | .go files |
Notes |
|---|---|---|
plugin/ (incl. pkg/ and test/) |
569 | 60+ in-tree plugins plus shared utilities |
test/ |
51 | End-to-end integration tests |
core/ |
30 | DNS server type, server constructors, request dispatch |
request/ |
6 | Request abstraction and ScrubWriter |
coremain/ |
5 | Bootstrap, flags, version, signal handling |
pb/ |
2 | Generated gRPC code from pb/dns.proto |
| Top-level | 3 | coredns.go, directives_generate.go, owners_generate.go |
Largest source files (non-test, non-generated)
| File | Lines |
|---|---|
plugin/kubernetes/controller.go |
910 |
plugin/kubernetes/kubernetes.go |
719 |
plugin/forward/setup.go |
(~600) |
core/dnsserver/server_quic.go |
(~420) |
plugin/dnssec/handler.go |
(~400) |
Tests dominate the longest-file list — plugin/kubernetes/handler_test.go is 1,189 lines, plugin/rewrite/rewrite_test.go is 1,160, and plugin/cache/cache_test.go is 910. None of these need refactoring; large tests are the norm for plugins with rich Caddyfile syntax.
Activity
CoreDNS has a steady pulse with a long tail of dependency bumps. Over the last 12 calendar months ending April 2026:
| Month | Commits |
|---|---|
| 2025-05 | 53 |
| 2025-06 | 33 |
| 2025-07 | 32 |
| 2025-08 | 54 |
| 2025-09 | 79 |
| 2025-10 | 41 |
| 2025-11 | 62 |
| 2025-12 | 54 |
| 2026-01 | 31 |
| 2026-02 | 32 |
| 2026-03 | 89 |
| 2026-04 | 60 |
Overall the repository has 4,750 commits since first commit on 2016-03-18 and 666 unique committer email addresses.
Churn hotspots (last 90 days)
| File | Commits |
|---|---|
go.mod |
67 |
go.sum |
66 |
.github/workflows/trivy-scan.yaml |
13 |
.github/workflows/scorecards.yml |
12 |
.github/workflows/codeql-analysis.yml |
11 |
.golangci.yml |
7 |
.github/workflows/golangci-lint.yml |
7 |
plugin/file/zone.go |
6 |
core/dnsserver/server_quic.go |
6 |
.github/workflows/go.test.yml |
6 |
The top of the list is dominated by tooling and dependencies. The first non-tooling entry is plugin/file/zone.go, then core/dnsserver/server_quic.go — both reflect ongoing refinement of the file backend and the DoQ implementation.
Bot-attributed commits
| Author | Total commits |
|---|---|
dependabot[bot] |
1,191 |
dependabot-preview[bot] |
234 |
coredns-auto-go-mod-tidy[bot] |
150 |
coredns[bot] |
38 |
That is roughly 1,613 of 4,750 historical commits, or about 34%, attributable to bot accounts (dependabot, coredns-auto-go-mod-tidy, coredns[bot]). This is a lower bound on automated work since AI coding assistants like Copilot leave no trace in git history. Almost all bot commits are dependency upgrades.
Plugins by the numbers
- In-tree plugin count: 60 (counted in
plugin.cfg). - Plugins with metrics: 26 (each ships a
metrics.go). - Plugins with fuzz harnesses: 5 (
*/fuzz.go). - Plugins implementing
Readiness: 5 (kubernetes,forward,health,ready,etcd). - External plugins referenced from
plugin.cfg: 1 (on:github.com/coredns/caddy/onevent).
Complexity
- 100 source files contain a
TODO,FIXME, orHACKcomment, with 224 occurrences total across the tree. - The chain compilation in
dnsserver.NewServerfolds an unbounded plugin list into a singleHandler. Even a 60-plugin Corefile (every in-tree plugin) compiles in microseconds. - Average package depth from the repo root is 3 (
plugin/<name>/<file>.go); the deepest is 5 (plugin/pkg/<name>/<sub>/<file>.go).
Dependencies
go.mod declares roughly 35 direct dependencies plus another ~150 indirect. Notable direct ones:
github.com/miekg/dns— the DNS message library that everything else builds on.github.com/coredns/caddy— the CoreDNS fork of Caddy v1 that hosts the server type.github.com/prometheus/client_golang— metrics.github.com/quic-go/quic-go— QUIC for DoQ and DoH3.k8s.io/{api,apimachinery,client-go}— Kubernetes informers for thekubernetesplugin.go.etcd.io/etcd/client/v3— etcd backend.github.com/aws/aws-sdk-go-v2/{config,service/route53,service/secretsmanager}— AWS Route53 and DNSSEC key storage.cloud.google.com/go(viagoogle.golang.org/api) — Cloud DNS.github.com/Azure/...— Azure DNS.github.com/oschwald/geoip2-golang/v2— geoip plugin.
See Reference: dependencies for the full listing.
Test coverage
| Statistic | Value |
|---|---|
| Test files | 332 |
Integration tests under test/ |
51 |
| Test lines of code | ~49k |
_test.go to non-test ratio |
~40% |
| CI matrix | 3 Go minor versions × 1 OS (Linux); see .github/workflows/go.test.yml |
CoreDNS does not publish a coverage percentage. The CI job runs go test -race ./... and asserts on success.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.