bavard

package module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 10

README

bavard

WIP -- used by

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apache2

func Apache2(copyrightHolder string, year int) func(*Bavard) error

Apache2 returns a bavard option to be used in Generate writing an apache2 licence header in the generated file

func BuildTag added in v0.1.1

func BuildTag(buildTag string) func(*Bavard) error

BuildTag returns a bavard option to be used in Generate adding build tags string on top of the generated file

func Format

func Format(v bool) func(*Bavard) error

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

func Funcs(funcs template.FuncMap) func(*Bavard) error

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

func GeneratedBy(label string) func(*Bavard) error

GeneratedBy returns a bavard option to be used in Generate writing a standard "Code generated by 'label' DO NOT EDIT"

func Import

func Import(v bool) func(*Bavard) error

Import returns a bavard option to be used in Generate. If set to true, will run goimports

func Package

func Package(name string, doc ...string) func(*Bavard) error

Package returns a bavard option adding package name and optional package documentation in the generated file

func Verbose

func Verbose(v bool) func(*Bavard) error

Verbose returns a bavard option to be used in Generate. If set to true, will print to stdout during code generation

Types

type Bavard

type Bavard struct {
	// contains filtered or unexported fields
}

Bavard root object to configure the code generation from text/template

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL