Develop a module
Use ferret mod init to create a standalone Go project with a Ferret module manifest, starter registration code, and a small package layout. The command creates the project locally without downloading dependencies.
Use the guided initializer
Run the command without arguments to start the interactive flow:
ferret mod init
The initializer explains and prompts for:
| Value | Purpose |
|---|---|
| Module name | Canonical lowercase Registry identity in owner/name form |
| Go module path | Import path written to go.mod and used by Go consumers |
| Directory | New destination directory for the project |
| Namespace | Case-sensitive FQL namespace exposed at runtime |
It shows the resolved configuration before creating any files. Canceling the confirmation leaves the destination untouched.
Initialize non-interactively
Provide the Registry identity and Go module path when the command cannot prompt:
ferret mod init acme/kvplugin \ --go-module github.com/acme/ferret-kvplugin \ --dir kvplugin \ --namespace kv
--dir and --namespace are optional. When omitted, both default from the kvplugin leaf of the module name. The destination must not already exist.
Review the generated project
The scaffold contains:
kvplugin/
├── ferret.yaml
├── go.mod
├── module.go
├── README.md
├── core/
│ └── doc.go
└── lib/
└── doc.go
ferret.yamlcontains a valid Module Manifest v1 with TODO metadata.go.modpins the Go and Ferret versions embedded in the CLI release.module.goreturns a module namedacme/kvpluginand provides the registration callback.coreis the starting point for implementation code.libis the starting point for Ferret-facing function bindings.README.mdis the documentation Barn will snapshot from a published tag.
The generated manifest is schema-valid, but its placeholder description, license, and documentation URL are not release metadata. Replace every TODO before publishing.
Keep distribution and runtime names separate
The generated manifest records both identities explicitly:
name: acme/kvplugin
namespace: kv
name identifies the module in the Registry and dependency metadata. namespace identifies its Ferret-facing API, such as kv::open. Changing one does not change the other.
Implement and test the module
Start by resolving the pinned dependencies:
cd kvplugingo mod tidy
Then register the module’s functions, values, codecs, or lifecycle hooks in module.go and keep implementation details in the appropriate packages. Run the Go test suite before preparing a release:
go test ./...
For a complete module implementation, see Develop a Ferret module.