posener / autogen

Automatically generate files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autogen

GoDoc

Package autogen automatically generates files from templates.

Usage

Create a main package somewhere in your project. In that package, locate templates for generating files. These templates should have the generated file names suffixed with ".gotmpl". The generated files will be located by default in the parent directory, but this location can be customized with the Location option. The main package should define the variables to be used in the templates and run the autogen.Execute function with this variable. The main package should include a //go:generate go run . comment. All that left to do is to run go generate ./... from the Go module's root.

See example at the ./example directory.

Sub Packages

  • example: Package example is a simple example that uses autogen.

Readme created from Go doc with goreadme

About

Automatically generate files

License:Apache License 2.0


Languages

Language:Go 100.0%