ValidateFormat checks that format is one of the supported values.
(format string, supported []string)
| 27 | |
| 28 | // ValidateFormat checks that format is one of the supported values. |
| 29 | func ValidateFormat(format string, supported []string) error { |
| 30 | if slices.Contains(supported, format) { |
| 31 | return nil |
| 32 | } |
| 33 | return fmt.Errorf("unsupported format: %s (supported: %s)", format, strings.Join(supported, ", ")) |
| 34 | } |
no outgoing calls