Documentation ¶
Index ¶
- Variables
- func DefaultValue(id Ident) string
- func EnglishName(name string) english.Name
- func FilterTests(fi fs.FileInfo) bool
- func GenerateCLI(srcDir, pkg, funcName, outFile string) error
- func GenerateHTTPHandler(srcDir, pkg, typeName, outFile string) error
- func ParseName(name string) (english.Name, error)
- func RunGoimports(path string) error
- type Field
- type FuncSignature
- type Ident
- type ImportMap
- type Name
- type Package
- type Type
- type Workdir
Constants ¶
This section is empty.
Variables ¶
var ErrMultiplePackages = errors.New("multiple packages found")
var ErrMultipleReceivers = errors.New("expected method to have one receiver")
Functions ¶
func DefaultValue ¶
func EnglishName ¶
func EnglishName(name string) english.Name
func FilterTests ¶
func GenerateCLI ¶
GenerateCLI geneates a simple Go CLI app that only calls a single func. The resulting command has no arguments. It reads function input from stdin in JSON format and writes the result to stdout in JSON format.
func GenerateHTTPHandler ¶
GenerateHandler generates ServeHTTP methods for each type declaration in the file. Experimental.
func RunGoimports ¶
Types ¶
type FuncSignature ¶
func ReadFuncSignature ¶
func ReadFuncSignature(srcDir, pkg, funcName string) (*FuncSignature, error)
ReadFuncSignature reads the function signature of a function in a package. srcDir should be a directory with all your source code. Packages in srcDir should be in the format "github.com/username/repo".
type Ident ¶
func BuildIdent ¶
type ImportMap ¶
ImportMap maps package paths to local variable names.
func (ImportMap) AddPackage ¶
AddPackage adds the given package path to the import map. It will ensure there are no naming conflicts by appending as many underscores as necessary to the end of the variable name.
type Package ¶
func ParsePackage ¶
type Type ¶
type Workdir ¶
type Workdir string
func SetupWorkdir ¶
func (Workdir) CloneGithubRepo ¶
CloneGithubRepo clones the given repo into the workdir at workdir/org/repo.
Source Files ¶
- build_ident.go
- build_import_map.go
- build_type.go
- default_value.go
- english_name.go
- err_multiple_packages.go
- err_multiple_receivers.go
- field.go
- filter_tests.go
- func_signature.go
- generate_cli.go
- generate_http_handler.go
- ident.go
- import_map.go
- name.go
- package.go
- parse_name.go
- parse_package.go
- read_func_signature.go
- run_goimports.go
- setup_workdir.go
- type.go
- workdir.go