Documentation ¶
Overview ¶
Package vault is a simple tool to embed resource and asset files into a go binary. It generates go source files containing encoded and compressed resource files. The generated source code provides an api to retrieve the embedded resources without any additional dependencies and therefore the vault package is only needed to generate those source files.
Documentation see https://github.com/go-sharp/vault
Index ¶
- Constants
- type Generator
- type GeneratorConfig
- type GeneratorOption
- func CompressOption(compress bool) GeneratorOption
- func ExcludeFilesOption(name ...string) GeneratorOption
- func IncludeFilesOption(name ...string) GeneratorOption
- func PackageNameOption(name string) GeneratorOption
- func RelativePathOption(p string) GeneratorOption
- func ResourceNameOption(name string) GeneratorOption
- func WithSubdirsOption(withSubdirs bool) GeneratorOption
Constants ¶
const (
// Version is the current vault version.
Version = "2.0.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator creates a vault with embedded files.
func NewGenerator ¶
func NewGenerator(src, dest string, options ...GeneratorOption) Generator
NewGenerator creates a new generator instance with the given options.
type GeneratorConfig ¶
type GeneratorConfig struct {
// contains filtered or unexported fields
}
GeneratorConfig configures the vault generator.
type GeneratorOption ¶
type GeneratorOption func(g *GeneratorConfig)
GeneratorOption configures the vault generator.
func CompressOption ¶
func CompressOption(compress bool) GeneratorOption
CompressOption if set to true all files will be compressed, otherwise no compression is used.
func ExcludeFilesOption ¶
func ExcludeFilesOption(name ...string) GeneratorOption
ExcludeFilesOption sets the files to exclude in the generation process. Only relative paths will be checked, so pattern must not include the fullpath. Pattern matching follows the rules of regexp.Match (see https://golang.org/pkg/regexp/#Match).
func IncludeFilesOption ¶
func IncludeFilesOption(name ...string) GeneratorOption
IncludeFilesOption sets the files to include in the generation process. Only specified files and files not matching any exclusion pattern will be included in the generation process. Only relative paths will be checked, so pattern must not include the fullpath. Pattern matching follows the rules of regexp.Match (see https://golang.org/pkg/regexp/#Match).
func PackageNameOption ¶
func PackageNameOption(name string) GeneratorOption
PackageNameOption sets the package name of the generated vault files. If not set, the generator tries to deduce the correct package name.
func RelativePathOption ¶
func RelativePathOption(p string) GeneratorOption
RelativePathOption sets the relative path for the debug asset loader. If not specified the generator uses the relative path from the directory where the generator was invoked.
func ResourceNameOption ¶
func ResourceNameOption(name string) GeneratorOption
ResourceNameOption sets the name of the generated resources.
func WithSubdirsOption ¶
func WithSubdirsOption(withSubdirs bool) GeneratorOption
WithSubdirsOption if set to true, the generator will walk down the folder tree with the source directory as root.