InferFileFormat infers the file format from the file path.
(path string)
| 199 | |
| 200 | // InferFileFormat infers the file format from the file path. |
| 201 | func InferFileFormat(path string) FileFormat { |
| 202 | extension := filepath.Ext(path) |
| 203 | switch extension { |
| 204 | case ".textproto": |
| 205 | return TextProto |
| 206 | case ".yaml": |
| 207 | return TextYAML |
| 208 | case ".binarypb", ".fds", ".pb": |
| 209 | return BinaryProto |
| 210 | case ".cel": |
| 211 | return CELString |
| 212 | case ".celpolicy": |
| 213 | return CELPolicy |
| 214 | default: |
| 215 | return Unspecified |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | // EnvironmentFile returns an EnvOption which loads a serialized CEL environment from a file. |
| 220 | // The file must be in one of the following formats: |
no outgoing calls
no test coverage detected