Open-Source Wikis

/

Caddy

/

How to contribute

/

Tooling

caddyserver/caddy

Tooling

The repo's build, lint, and release tooling. Everything here is Go-based.

Lint: golangci-lint

Configuration: .golangci.yml.

golangci-lint run --timeout 10m

CI runs the same command in .github/workflows/lint.yml. The config enables a curated set of linters and disables a small list per-file when there's a justified reason. Adding new lint waivers should be a last resort.

Build: go build

The default binary entry point is cmd/caddy/main.go. CI builds it as:

cd cmd/caddy
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s"

The -trimpath and -ldflags="-w -s" flags strip GOPATH and DWARF info to keep binaries small and reproducible.

Plugin builds: xcaddy

xcaddy (https://github.com/caddyserver/xcaddy) is a small wrapper that:

  1. Generates a main.go that imports a list of plugin packages.
  2. Runs go build against the generated module.
  3. Pins the requested Caddy version.
xcaddy build --with github.com/lucaslorentz/caddy-docker-proxy
xcaddy build --with github.com/caddyserver/cache-handler@latest

The CI workflow cross-build.yml exercises xcaddy to confirm the public API stays plugin-friendly.

Release: goreleaser

Configuration: .goreleaser.yml. The release pipeline (.github/workflows/release.yml) runs goreleaser on tag pushes and produces:

  • Linux, macOS, Windows, FreeBSD binaries on amd64, arm64, arm, ppc64le, s390x.
  • Debian/RPM packages.
  • A SBOM and provenance.

Cloudsmith hosts the official Debian repo (per the README's footer note).

Auxiliary release workflows:

  • release-proposal.yml — opens a release PR with bumped versions.
  • auto-release-pr.yml — automates the post-merge release tagging.
  • release_published.yml — runs after a release is published (notifications, downstream triggers).
  • scorecard.yml — OSSF Scorecard runs.

Pre-commit hooks

.pre-commit-config.yaml defines hooks (whitespace, end-of-file fixer, gofmt). Install with pre-commit install. The repo doesn't require pre-commit, but it's the easiest way to catch formatting drift before CI does.

Editor / formatting

.editorconfig sets the basics (LF line endings, tab indent for *.go). gofmt/goimports apply on save in any standard Go editor.

Memory and CPU autotuning

cmd/main.go imports two runtime tuners:

  • automaxprocs — sets GOMAXPROCS based on cgroup CPU quotas (useful when running in containers).
  • automemlimit — sets GOMEMLIMIT based on cgroup memory quotas.

These run at startup; you usually don't need to think about them.

CI matrix

.github/workflows/ci.yml:

  • OS: Linux (Ubuntu), macOS (14), Windows.
  • Go: ~1.26.
  • Steps: build, smoke-test (caddy start && caddy stop), go test -short -race ./....
  • Bonus jobs: s390x-test over SSH, goreleaser-check for snapshot builds.

.github/workflows/ai.yml is a small workflow related to AI policy enforcement on PRs. dependabot.yml keeps Go modules and GitHub Actions up to date.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Tooling – Caddy wiki | Factory