odinfmt
Odinfmt formats targets declared with odinPackage() and
odinTestPackage():
imp fmt //src/game:game
imp fmt --check //src/game:game_tests
Odinfmt has no native read-only check mode. Both operations therefore run
odinfmt -w in a sandbox. Write mode materializes changed source files back to
the workspace; check mode keeps the sandbox result private and compares its
content digest with the original files. This checks the formatter's actual
output without parsing diagnostics or relying on timestamps.
Only sources owned by the selected package are formatted. Dependency packages must be selected through their own targets, which prevents one package's format operation from unexpectedly rewriting another package's files.
Odinfmt is acquired from the OLS release that matches the Odin compiler
version. odinfmtToolchain(version, { lockfile }) selects a lockfile that
this workspace owns instead of the shipped
//rules/odin/odinfmt/odinfmt.lock. See "Select a workspace lockfile" in
rules/odin/DOC.md.
Configuration
odinfmtToolchain()
odinfmtToolchain(version, opts = {})
Declare an odinfmt toolchain, pinned to an Odin toolchain version. Omit version to track the workspace's default Odin toolchain version. defaults to the bundled //rules/odin/odinfmt/odinfmt.lock. Point this at your own lock (regenerate via imp goal gen-lockfiles) when pinning a version the bundled lock does not know. matching lockfile entry (warns instead of failing).
| Parameter | Type | Description |
|---|---|---|
| [version] | string | |
| [opts] | object | |
| [opts.default=false] | boolean | Set as the default odinfmt target. |
| [opts.lockfile] | string | Lockfile address pinning download SHA-256s; |
| [opts.unverified=false] | boolean | Allow downloading without a |
Returns: object Target handle for this odinfmt toolchain.