Guide
Packages
Organize local modules, install pinned dependencies, and resolve host imports.
Modules before packages
Local multi-file programs do not need package metadata. Import a sibling math.echo file or a math/ folder with the same path. A folder module combines the exports of its sorted *.echo files; private bindings remain file-local.
/ ./math
$ total = math.add(20, 22)
Install a dependency
xo get github.com/acme/lib@v1.2.3
xo get github.com/acme/lib@dev --path ../lib
xo get github.com/acme/lib@v1.2.3 --deps
xo home
Use an explicit tag, branch, or commit when reproducibility matters. --path copies a local source tree into the same user package cache; --deps recursively installs dependencies declared by that package. xo home prints the active user root and package directory.
Pin project dependencies
Place xo.toml in the working directory used to run xo. The tool reads its [dependencies] table and automatically installs a missing pinned dependency during check, run, or build.
[dependencies]
"github.com/acme/lib" = "v1.2.3"
/ github.com/acme/lib/math
$ answer = math.add(20, 22)
Resolution rules
An import binds its last path segment, so the example above binds math. Echo has no import aliases or star imports. Two imports with the same final segment conflict, import cycles are errors, and external packages are never vendored into the project’s .xo/cache.
Troubleshoot resolution
xo check --graph main.echo
xo check --diag-codes main.echo
xo home
res-import means the target could not be resolved, res-import-name-conflict means two imports want the same binding, and res-import-cycle reports a cycle in the closed module graph.