Skip to content

Building binaries from source

Nick Kwiatkowski edited this page Nov 25, 2026 · 1 revision

Building binaries from source

The full development workflow. For just getting a binary, see Building CLIF from source.

Toolchain

Tool Version / note Needed for
Go The go directive in go.mod (currently 1.27.4). Older toolchains download the right one automatically when GOTOOLCHAIN allows Everything
C compiler gcc or clang (mingw-w64 on Windows). CGO_ENABLED=1 The tree-sitter grammar
make, bash GNU make; the Makefile uses sh/bash, awk, curl make targets (use WSL or Git Bash/MSYS2 on Windows)
Network GitHub release downloads make build fetches the pinned CFLint; make docs/generate/framework-stubs fetch sources
Node + npm Only for make update-d3 Rebuilding the code-map viewer's D3 bundle
WASI SDK Only for make build-wasm (WASI_SDK, default /opt/wasi-sdk) The WebAssembly build

golangci-lint and govulncheck are not taken from PATH: the Makefile builds pinned versions under this module's Go toolchain (target/tools/), so a distro linter built with an older Go cannot refuse to start.

git clone https://github.com/cfmleditor/clif.git
cd clif
make dev-tools     # optional: build the pinned linter once
make build
./target/release/clif --version

Build targets

Target Output Notes
make build target/release/clif (+ cfmleditor-lsp symlink) -trimpath -ldflags "-s -w -X main.version=$(cat VERSION)", with -tags cflint_embed after scripts/fetch-cflint.sh downloads this platform's pinned CFLint into internal/cflint/embedded/. Falls back to no embedded CFLint (with a warning) if the fetch fails
make build-wasm target/release/clif.wasm GOOS=wasip1 GOARCH=wasm, compiled with the WASI SDK's clang. Always runs unsupervised
make cfparse-build target/release/cfparse Debug parser; make cfparse <file> builds and runs it
make install $(go env GOPATH)/bin/clif (+ legacy link) Copy of the build
make link / unlink / link-status Symlinks in LINK_DIR (default $(go env GOPATH)/bin) For editor extensions that look on PATH; refuses to replace a real file
make clean — Removes target/ (including cached tools)

Build tags

Tag Effect
cflint_embed Embed internal/cflint/embedded/cflint.archive into the binary. Release builds always use it
passcount Counts file reads in batch scans; used by two guard tests

Cross-compiling

CGO makes cross-compilation need a C cross-compiler for the target:

CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc \
  go build -trimpath -ldflags="-s -w -X main.version=dev" -o clif-linux-arm64 ./cmd/clif

Releases build each platform natively on CI runners (see .github/workflows/release.yml).

Testing

Target / command What it runs
make test go test ./..., then a one-line definition conformance score against the cfmleditor extension's own suite
go test -short ./... What CI runs: skips wall-clock performance assertions a shared runner cannot meet
make conformance The conformance suite verbosely, listing every known gap
make visualtest TestFormatOutput: formatter output for visual review
make gapcheck [CORPUS=dir:dir] Parser vs. grammar agreement on calls; with CORPUS, a report on real code
make corpus CORPUS=dir[:dir] [REPORT=f] [BASELINE=f] [OPTS=k=v,…] Formats a real-world corpus; reports clean / grammar-refused / guard-rejected / non-idempotent files. BASELINE fails on any changed verdict
make shrink REPORT=f Reduces corpus refusals to the smallest failing fragment
make resolution-report CORPUS="name=dir …" unresolved --json --candidates over named corpora

Examples:

make test
go test -run TestFormatOutput -v ./internal/formatter/
make corpus CORPUS=/src/Lucee:/src/ContentBox REPORT=/tmp/corpus.tsv
make corpus CORPUS=/src/Lucee OPTS=braceStyle=next-line,paramBreakThreshold=3

Before you push: make check

make check runs every check CI runs on a pull request, in one command:

Step Command
Build go build ./...
Vet go vet ./...
Vet the CFLint-embedding build go vet -tags cflint_embed ./internal/cflint/ ./cmd/clif/ (against an empty stand-in archive if none exists) and its short tests
Formatting scripts/check-go-format.sh (gofmt)
Tests under the race detector go test -short -race ./...
Scan-pass guards Two passcount tests
Lint Pinned golangci-lint with .golangci.yml
Vulnerabilities Pinned govulncheck (GOWORK=off)

Related targets:

Target Effect
make fmt gofmt -w . then golangci-lint run --fix
make lint golangci-lint (GOLANGCI_FLAGS passes extra flags)
make lint-fix golangci-lint with --fix
make vuln govulncheck only

CI jobs

Job Runs
Build and test Build, vet, CFLint-embed vet, gofmt check, go test -short ./..., scan-pass guards
Race detector go test -short -race ./...
Lint, vulnerabilities, docs, install scripts, package managers Further jobs in .github/workflows/

Generated and vendored content

These are committed; regenerate them deliberately and review the diff.

Target Regenerates Needs
make generate internal/docs/generated_docs.go (embedded tag/function docs). Refuses to write a file that lost entries Network (cfdocs at the commit docs/sources.lock pins)
make docs / docs-cfdocs / docs-assemble Stage and assemble doc sources Network
make docs-bump Moves the cfdocs pin and vendored Lucee docs to upstream latest; follow with make generate Network
make update-grammar Bumps tree-sitter-cfml, refreshes internal/language/queries/injections.scm, then runs make generate Network
make framework-stubs internal/frameworkapi/stubs from each pinned framework source Network, git
make update-d3 internal/codemap/assets/vendor/d3.bundle.js Node/npm

make build never regenerates anything: a build compiles what is committed, as CI and releases do.

Releases

Target Effect
make release-dry <args> Runs scripts/release.go --dry-run <args>: shows what a release would do without doing it
make release <args> Runs scripts/release.go <args> to cut a release (see the script for its arguments)

Pushing the tag triggers .github/workflows/release.yml, which builds every platform natively with CFLint embedded (no fallback), writes checksums.txt and per-archive .sha256 files, signs build provenance attestations, and publishes the assets listed in Downloading the CLIF binaries. The package-manager workflow then updates Homebrew, Scoop, winget and Chocolatey.

Profiling

CLIF_CPUPROFILE=cpu.out CLIF_MEMPROFILE=mem.out clif unresolved ~/src/app > /dev/null
go tool pprof -http=:8080 target/release/clif cpu.out

For the language server, set the same variables in the editor's environment for the server, together with CLIF_NO_SUPERVISOR=1 so the profile belongs to the process you are measuring.

← Contributor Documentation · Home

Clone this wiki locally