hof mod helps you manage
CUE modules and dependencies.
They are based on Go modules,
can be backed by git or oci,
support public and private visibility,
and make working with CUE modules easy!
A CUE module is a collection of packages and
is recognized by a
module: "github.com/org/repo" field.
The modules and packages work like other languages,
allowing you to organize your code and later import it elsewhere.
CUE is already module aware but lacks dependency management.
hof mod fills that gap to make working with modules easy.
hof mod is based on Go modules, so you will recognize
both the commands and the dependency file.
hof reuses much of the algorithm.
The main difference is the file location and format.
Another notable difference is that
hof has no
global servers or registries, and instead talks
directly to the code host to avoid adding more
middlemen in your software supply chain.
A brief introduction is below while the following pages go into detail.
Creating a Module
To create a new module, run
hof mod init <module-path>.
This will create a
If you have already manually made the
cue.mod/module.cue file, then you can skip this step.
It is best to use the same path as the Git repository. This makes your code immediately reuseable by pushing commits or a semver tag.
Adding a Dependency
hof mod get to add and fetch a new dependency.
Hof recogonizes semver tags,
several special version names,
and allows for any commit hash.
hof mod tidy to inspect your imports,
update the dependency list, and fetch any missing modules.
This command will update both
which is used to store module hashes.
You can verify code integrity later by running
hof mod verify.
You can update dependency versions with
hof mod get
hof mod get <module-path>@latestor
@nextfor a prerelease
hof mod get all@latestto update all dependencies to their most recent version
Hof supports two methods for fetching dependencies into your project.
hof mod vendorwill copy the files into
hof mod linkwill symlink the directories into
The choice can depend on personal preference or system requirements.
(Windows does not support symlinks)
Linking makes co-development with local replaces easier,
as changes are automatic and
do not require you to run
hof mod vendor to get updates
from another directory.
hof mod fetches and copies module code into your system’s cache directory.
This acts as a per-users, local module cache and helps reduce network requests and disk space.
A module will only be fetched once on a system.
You can find the cache directory in
hof version and
you can delete it with
hof mod clean.
Note, Hofstadter does not run any proxies or sumdb and all requests go directly to the module host.