GetSource returns a registered source by name.
(name string)
| 14 | |
| 15 | // GetSource returns a registered source by name. |
| 16 | func GetSource(name string) (Source, error) { |
| 17 | s, ok := sources[name] |
| 18 | if !ok { |
| 19 | return nil, fmt.Errorf("unknown source: %q (registered: %v)", name, RegisteredNames()) |
| 20 | } |
| 21 | return s, nil |
| 22 | } |
| 23 | |
| 24 | // Unregister removes a source from the registry. Intended for testing. |
| 25 | func Unregister(name string) { |
no test coverage detected