gocharm: github.com/juju/gocharm/cmd/gocharm Files

Command gocharm

Gocharm processes a Go package ("." by default) and installs 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)
-series="trusty": select the os version to deploy the charm as
-source=false: include source code instead of binary executable
-v=false: print information about charms being built

If the -source flag is specified, all source dependencies are installed in the destination charm directory, otherwise just the package source itself and the compiled binary.

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/juju/gocharm/hook) for an explanation of the hook registry.

The hook is installed into the $JUJU_REPOSITORY/$series/$name directory for each series specified on the command line (the current series by default); $name is the last element of the package path (it can be overridden with the -name flag). This directory is referred to as $charmdir below.

For a package $pkg, the package source and all its subdirectories will be stored in $charmdir/src/$pkg.

Some files in the package source directory are treated specially:


metadata.yaml will have registered relations added, and is installed in $charmdir/metadata.yaml .


If there is a directory named "assets", a symbolic link to it will be created in $charmdir.

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/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.

Package Files

gocharm.go inspect.go main.go

Package main imports 19 packages (graph). Updated 2017-05-30. Refresh now. Tools for package owners.