Documentation
¶
Overview ¶
Package bavard contains helper functions to generate consistent code from text/template templates it is used by github.com/consensys/gurvy && github.com/consensys/gnark && github.com/consensys/goff
Index ¶
- func Apache2(copyrightHolder string, year int) func(*Bavard) error
- func Apache2Header(copyrightHolder string, year int) string
- func BuildTag(buildTag string) func(*Bavard) error
- func Format(v bool) func(*Bavard) error
- func Funcs(funcs template.FuncMap) func(*Bavard) error
- func Generate(output string, templates []string, data interface{}, ...) error
- func GeneratedBy(label string) func(*Bavard) error
- func Import(v bool) func(*Bavard) error
- func Package(name string, doc ...string) func(*Bavard) error
- func Verbose(v bool) func(*Bavard) error
- type Bavard
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apache2 ¶
Apache2 returns a bavard option to be used in Generate writing an apache2 licence header in the generated file
func Apache2Header ¶ added in v0.1.6
Apache2Header returns a Apache2 header string
func BuildTag ¶ added in v0.1.1
BuildTag returns a bavard option to be used in Generate adding build tags string on top of the generated file
func Format ¶
Format returns a bavard option to be used in Generate. If set to true, will run gofmt on generated file. Or simple tab alignment on .s files
func Funcs ¶ added in v0.1.1
Funcs returns a bavard option to be used in Generate. See text/template FuncMap for more info
func Generate ¶
func Generate(output string, templates []string, data interface{}, options ...func(*Bavard) error) error
Generate will concatenate templates and create output file from executing the resulting text/template see other package functions to add options (package name, licensing, build tags, ...)
func GeneratedBy ¶
GeneratedBy returns a bavard option to be used in Generate writing a standard "Code generated by 'label' DO NOT EDIT"
func Import ¶
Import returns a bavard option to be used in Generate. If set to true, will run goimports