gencode

package
v0.0.0-...-1743fbf Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPrefix = "/usr/local"

DefaultPrefix used as prefix

Variables

This section is empty.

Functions

func AreFilesIdentical

func AreFilesIdentical(originalPath, generatedPath string, filters []*regexp.Regexp) (bool, error)

AreFilesIdentical compares orginal and generated files. filters regexps are used to ignore dates and other potential differences. TODO: will probably be better with some io.Reader

func CopyTree

func CopyTree(src string, dest string) error

CopyTree copies a whole directory recursively

func CreateTemp

func CreateTemp(name string, directory bool) (string, func(), error)

CreateTemp creates a temporary file and directory while returning teardown function

func Install

func Install(src, dest, destdir, prefix string) error

Install copies src to dest, prefixing as needed destdir/prefix/ and making sanity checks

func InstallCheckFlags

func InstallCheckFlags() (check *bool, verbose *bool)

InstallCheckFlags returns check specific flags

func IsCheckMode

func IsCheckMode(checkMode bool) bool

IsCheckMode enhanced checkmod with an env variable GOGENERATE_CHECK

Types

type GenCode

type GenCode struct {
	Generator

	Dest string

	CheckMode            bool
	Verbose              bool
	IgnoreInCheckFilters []*regexp.Regexp
	FilesToIgnore        []string

	Close func()
	// contains filtered or unexported fields
}

GenCode is the struct used to defined Generation, checking and cleanup

func (*GenCode) GenerateAndCheck

func (g *GenCode) GenerateAndCheck() error

GenerateAndCheck will generate from Generator, and optionally check if the generation is fine. Output should be cleaned up by using Close()

type Generator

type Generator interface {
	Generate(dest string) error
}

Generator defines a standard Generate in dest behavior

Jump to

Keyboard shortcuts

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