testing native go plugins
This commit is contained in:
		| @@ -24,9 +24,13 @@ type Plugin interface { | ||||
| var namePlugins = map[string]Plugin{} | ||||
| var nameSourceType = map[string]data.SourceType{} | ||||
|  | ||||
| func RegisterPlugin(plugin Plugin) { | ||||
| func RegisterPlugin(plugin Plugin) error { | ||||
| 	name := plugin.Name() | ||||
|  | ||||
| 	if _, ok := namePlugins[name]; ok { | ||||
| 		return errors.New("plugin " + name + " is already registered") | ||||
| 	} | ||||
|  | ||||
| 	nameSourceType[name] = data.SourceType{ | ||||
| 		Name:        name, | ||||
| 		Regex:       plugin.Regex(), | ||||
| @@ -36,6 +40,7 @@ func RegisterPlugin(plugin Plugin) { | ||||
| 	} | ||||
|  | ||||
| 	namePlugins[name] = plugin | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func compileSourceType(source data.Source) (data.Source, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user