(path string, format FileFormat, out protoreflect.ProtoMessage)
| 186 | } |
| 187 | |
| 188 | func loadProtoFile(path string, format FileFormat, out protoreflect.ProtoMessage) error { |
| 189 | unmarshaller := proto.Unmarshal |
| 190 | if format == TextProto { |
| 191 | unmarshaller = prototext.Unmarshal |
| 192 | } |
| 193 | data, err := loadFile(path) |
| 194 | if err != nil { |
| 195 | return err |
| 196 | } |
| 197 | return unmarshaller(data, out) |
| 198 | } |
| 199 | |
| 200 | // InferFileFormat infers the file format from the file path. |
| 201 | func InferFileFormat(path string) FileFormat { |
no test coverage detected