Documentation ¶
Overview ¶
Gocharm processes a Go package ("." by default) and builds it as a Juju charm. It should be invoked as follows:
gocharm [flags] [package]
The following flags are supported:
-repo="": charm repo directory (defaults to $JUJU_REPOSITORY) -v=false: print information about charms being built
In order to qualify as a charm, a Go package must implement a RegisterHooks function with the following signature:
func RegisterHooks(r *hook.Registry)
This function should register any resources required by the charm when it runs, including hooks, relations, configuration options. See the hook package (github.com/mever/gocharm/v2/hook) for an explanation of the hook registry.
The charm is installed into the $JUJU_REPOSITORY/$name directory. $name is the last element of the package path. This directory is referred to as $charmdir below.
If there is a file named README.md, a copy of it will be created in $charmdir.
The charm binary will be installed into $charmdir/bin/runhook. A $charmdir/config.yaml file will be created containing all registered charm configuration options. A hooks directory will be created containing an entry for each registered hook.