SourceByName returns the source that has the given name.
(name string)
| 62 | |
| 63 | // SourceByName returns the source that has the given name. |
| 64 | func SourceByName(name string) (Source, error) { |
| 65 | for s, n := range sourceNames { |
| 66 | if n == name { |
| 67 | return s, nil |
| 68 | } |
| 69 | } |
| 70 | return -1, fmt.Errorf("unknown source %q", name) |
| 71 | } |
| 72 | |
| 73 | // String returns the string representation of a source. |
| 74 | func (s Source) String() string { |