diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-16 23:20:23 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-16 23:23:43 +0200 |
commit | 1d678dfdfa026968dbb19795c9bed16385603b21 (patch) | |
tree | cac862609d0103ee30da39cd0054b11884248e9d /vendor/github.com/shurcooL/vfsgen/options.go | |
parent | 131a862d313f12808d63e832126317a27226940b (diff) | |
download | git-bug-1d678dfdfa026968dbb19795c9bed16385603b21.tar.gz |
vendor dependencies with dep
Diffstat (limited to 'vendor/github.com/shurcooL/vfsgen/options.go')
-rw-r--r-- | vendor/github.com/shurcooL/vfsgen/options.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/vendor/github.com/shurcooL/vfsgen/options.go b/vendor/github.com/shurcooL/vfsgen/options.go new file mode 100644 index 00000000..d10d348e --- /dev/null +++ b/vendor/github.com/shurcooL/vfsgen/options.go @@ -0,0 +1,45 @@ +package vfsgen + +import ( + "fmt" + "strings" +) + +// Options for vfsgen code generation. +type Options struct { + // Filename of the generated Go code output (including extension). + // If left empty, it defaults to "{{toLower .VariableName}}_vfsdata.go". + Filename string + + // PackageName is the name of the package in the generated code. + // If left empty, it defaults to "main". + PackageName string + + // BuildTags are the optional build tags in the generated code. + // The build tags syntax is specified by the go tool. + BuildTags string + + // VariableName is the name of the http.FileSystem variable in the generated code. + // If left empty, it defaults to "assets". + VariableName string + + // VariableComment is the comment of the http.FileSystem variable in the generated code. + // If left empty, it defaults to "{{.VariableName}} statically implements the virtual filesystem provided to vfsgen.". + VariableComment string +} + +// fillMissing sets default values for mandatory options that are left empty. +func (opt *Options) fillMissing() { + if opt.PackageName == "" { + opt.PackageName = "main" + } + if opt.VariableName == "" { + opt.VariableName = "assets" + } + if opt.Filename == "" { + opt.Filename = fmt.Sprintf("%s_vfsdata.go", strings.ToLower(opt.VariableName)) + } + if opt.VariableComment == "" { + opt.VariableComment = fmt.Sprintf("%s statically implements the virtual filesystem provided to vfsgen.", opt.VariableName) + } +} |