Generate

The goht generate command is what you will be using to generate Go code from your GoHT templates.

Help

To get help with the goht generate command, you can run the following command:

$ goht generate -h

Usage

Without any other flags, the goht generate command will generate Go code from the Haml templates in the current directory and its subdirectories.

It will look for .goht files and will put the generated Go code in the same directory as the .goht file into a .goht.go file with the same name.

For example, if you have a file my_template.goht in the templates directory, the generated Go code will be in templates/my_template.goht.go.

The goht generate command also supports the following flags:

  • --force - Force the generation of Go code even if the .goht.go file already exists and is newer than the .goht file.
  • --keep - Keep any orphaned .goht.go files that are not associated with a .goht file.
  • --max-workers int - The maximum number of workers to use when generating Go code. The default is the number of CPUs on the machine.
  • --path - The path to the directory containing the .goht files to generate Go code from. The default is the current directory.
  • --skip-dirs strings - A comma-separated list of directory names to skip when looking for .goht files to generate Go code from. The default is vendor,node_modules.
  • --watch - Watch the directory for changes and regenerate Go code when changes are detected.