MCPcopy Create free account
hub / github.com/cel-expr/cel-go / InferFileFormat

Function InferFileFormat

tools/compiler/compiler.go:201–217  ·  view source on GitHub ↗

InferFileFormat infers the file format from the file path.

(path string)

Source from the content-addressed store, hash-verified

199
200// InferFileFormat infers the file format from the file path.
201func 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:

Callers 8

ParseTextprotoMethod · 0.92
ParseYAMLMethod · 0.92
EnvironmentFileFunction · 0.85
TypeDescriptorSetFileFunction · 0.85
CreateASTMethod · 0.85
CreateASTMethod · 0.85
CreateASTMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected