Skip to content

Latest commit

 

History

History
105 lines (77 loc) · 1.75 KB

File metadata and controls

105 lines (77 loc) · 1.75 KB

Dependencies (@deps)

A # @deps line immediately above a script runs other scripts first, then the body.

# @dependencies is an alias of @deps.

Basic order

version: "0.1"

scripts:
  vet: go vet ./...
  test: go test ./...
  # local gate
  # @deps vet, test
  check: go build -o app .
godo --preview check

Prints (deps first, then body):

go vet ./...
go test ./...
go build -o app .
godo --ls check

Prints the definition (deps listed, body not expanded):

local gate
@deps vet
@deps test
check:
  go build -o app .

Rules (with expected outcomes)

Entries are comma-separated. Each entry is its own script invocation (space-separated tokens inside the entry).

Caller args are not forwarded to deps.

scripts:
  seed: echo seed ${godo:args}
  # @deps seed
  ship: echo ship ${godo:args}
godo --preview ship --prod

Prints:

echo seed 
echo ship --prod

(seed got no leftover tokens; empty ${godo:args} still expands in place.)

No ${godo:args} inside @deps. Use captures already bound by a matcher key instead (lint ${MODULE}).

Cycles error. Deps form a DAG: a node several scripts depend on runs once, at its first (deepest-first) position.

scripts:
  leaf: echo leaf
  # @deps leaf
  mid: echo mid
  # @deps mid, leaf
  root: echo root
godo --preview root

Prints:

echo leaf
echo mid
echo root

Dedup keys on the expanded invocation, not the script, so a matcher dep reached with different captures stays distinct — @deps lint pay, lint auth runs both.

Next