gogen

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 18 Imported by: 15 modules, 21 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Version = "v0.2.0"

Version of gogen

Variables

View Source
var TemplateHelpers = map[string]interface{}{}

Functions

func AddImport

func AddImport(gf genny.File, imports ...string) (genny.File, error)

AddImport adds n number of import statements into the path provided

func AddInsideBlock

func AddInsideBlock(gf genny.File, search string, expressions ...string) (genny.File, error)

AddInsideBlock will add anything inside of the app declaration block inside of file

func Append

func Append(gf genny.File, expressions ...string) (genny.File, error)

Append allows to append source into a go file

func Fmt

func Fmt(root string) (*genny.Generator, error)

func FmtTransformer

func FmtTransformer() genny.Transformer

func Get

func Get(pkg string, args ...string) *exec.Cmd

func GoFiles

func GoFiles(dir string) ([]string, error)

func Install

func Install(pkg string, args ...string) genny.RunFn

func PackageName

func PackageName(f genny.File) (string, error)

func ReplaceBlockBody

func ReplaceBlockBody(gf genny.File, search string, expressions ...string) (genny.File, error)

ReplaceBlockBody will replace found block with expressions passed

func RewriteImports

func RewriteImports(gf genny.File, swaps map[string]string) (genny.File, error)

func TemplateTransformer

func TemplateTransformer(data interface{}, helpers map[string]interface{}) genny.Transformer

TemplateTransformer will run any file that has a ".tmpl" extension through text/template

Types

type ParsedFile

type ParsedFile struct {
	File    genny.File
	FileSet *token.FileSet
	Ast     *ast.File
	Lines   []string
}

func ParseFile

func ParseFile(gf genny.File) (ParsedFile, error)

func ParseFileMode

func ParseFileMode(gf genny.File, mode parser.Mode) (ParsedFile, error)

Directories

Path Synopsis
You can use the "packr2 clean" command to clean up this, and any other packr generated files.
You can use the "packr2 clean" command to clean up this, and any other packr generated files.

Jump to

Keyboard shortcuts

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