readme: fixed formatting issue and added tip

This commit is contained in:
David Allen 2025-01-07 13:11:25 -07:00
parent 733c486cb2
commit 3fa7b80802
Signed by: towk
GPG key ID: 793B2924A49B3A3F

View file

@ -154,14 +154,13 @@ func (g *MyGenerator) Generate(config *configurator.Config, opts ...util.Option)
}
}
> [!NOTE]
> The keys in `generator.ApplyTemplate` must not contain illegal characters such as a `-` or else the templates will not apply correctly.
// this MUST be named "Generator" for symbol lookup in main driver
var Generator MyGenerator
```
> [!NOTE]
> The keys in `generator.ApplyTemplate` must not contain illegal characters such as a `-` or else the templates will not apply correctly.
Finally, build the plugin and put it somewhere specified by `plugins` in your config. Make sure that the package is `main` before building.
```bash
@ -170,6 +169,9 @@ go build -buildmode=plugin -o lib/mygenerator.so path/to/mygenerator.go
Now your plugin should be available to use with the `configurator` main driver program. If you get an error about not loading the correct symbol type, make sure that your generator function definitions match the `Generator` interface entirely and that you don't have a partially implemented interface.
> [!TIP]
> See the `examples/test.go` file for a plugin and template example.
## Configuration
Here is an example config file to start using configurator: