fix: changed variable name to avoid collision with package

This commit is contained in:
David Allen 2024-12-18 12:47:29 -07:00
parent 895b539c66
commit 1f87b180b9
Signed by: towk
GPG key ID: 793B2924A49B3A3F

View file

@ -165,23 +165,23 @@ func LoadPlugins(dirpath string, opts ...Option) (map[string]Generator, error) {
// This function requires that a target and plugin path be set at minimum. // This function requires that a target and plugin path be set at minimum.
func Generate(plugin string, params Params) (FileMap, error) { func Generate(plugin string, params Params) (FileMap, error) {
var ( var (
generator Generator gen Generator
ok bool ok bool
err error err error
) )
// check if generator is built-in first before loading external plugin // check if generator is built-in first before loading external plugin
generator, ok = DefaultGenerators[plugin] gen, ok = DefaultGenerators[plugin]
if !ok { if !ok {
// only load the plugin needed for this target if we don't find default // only load the plugin needed for this target if we don't find default
log.Error().Msg("could not find target in default generators") log.Error().Msg("could not find target in default generators")
generator, err = LoadPlugin(plugin) gen, err = LoadPlugin(plugin)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to load plugin from file: %v", err) return nil, fmt.Errorf("failed to load plugin from file: %v", err)
} }
} }
return generator.Generate(nil, params) return gen.Generate(nil, params)
} }
// Main function to generate a collection of files as a map with the path as the key and // Main function to generate a collection of files as a map with the path as the key and