Skip to content
Latchkey

just: Recipe Dependencies and Ordering

just dependencies are recipes listed after a colon that run before the recipe body.

Dependencies build a small ordered graph: a release recipe can require lint and test to pass first. just runs each dependency once per invocation.

What it does

Dependencies are recipe names placed after the recipe name and colon: "release: lint test". They run, in order, before the recipe body. Dependencies that take arguments use parentheses: "deploy: (build "prod")". A dependency runs at most once per just invocation even if listed by several recipes.

Common usage

justfile
# justfile
lint:
    golangci-lint run

test:
    go test ./...

# release runs lint, then test, then its own body
release: lint test
    goreleaser release --clean

# dependency with an argument
build target:
    go build -o bin/{{target}} ./cmd/{{target}}

deploy: (build "server")
    ./deploy.sh

Syntax

FormWhat it does
recipe: dep1 dep2Run dep1 then dep2 before the recipe body
recipe: (dep "arg")Run a dependency with an argument
recipe: dep && afterafter runs after the recipe body (subsequent dep)
just recipeTriggers all dependencies in order

In CI

Encode the gate order in dependencies (lint then test then build) so one just release call enforces the whole sequence and stops at the first failure. Because a dependency runs once per invocation, shared setup steps are not repeated.

Common errors in CI

"error: Recipe release depends on tset which is not defined" means a dependency name is wrong or lives in an unincluded file. A dependency that fails stops the chain and just exits non-zero with "error: Recipe lint failed on line N with exit code K". Circular dependencies report "error: Recipe a depends on itself".

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →