loadFile loads messages, enumerations and fields from "file". It does not load services and methods in "file". You need to call loadServices after loadFiles is called for all files to load services and methods.
(filePath string, file *protogen.File)
| 272 | // It does not load services and methods in "file". You need to call |
| 273 | // loadServices after loadFiles is called for all files to load services and methods. |
| 274 | func (r *Registry) loadFile(filePath string, file *protogen.File) { |
| 275 | pkg := GoPackage{ |
| 276 | Path: string(file.GoImportPath), |
| 277 | Name: string(file.GoPackageName), |
| 278 | } |
| 279 | if r.standalone { |
| 280 | pkg.Alias = "ext" + cases.Title(language.AmericanEnglish).String(pkg.Name) |
| 281 | } |
| 282 | |
| 283 | if err := r.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil { |
| 284 | for i := 0; ; i++ { |
| 285 | alias := fmt.Sprintf("%s_%d", pkg.Name, i) |
| 286 | if err := r.ReserveGoPackageAlias(alias, pkg.Path); err == nil { |
| 287 | pkg.Alias = alias |
| 288 | break |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | f := &File{ |
| 293 | FileDescriptorProto: file.Proto, |
| 294 | GoPkg: pkg, |
| 295 | GeneratedFilenamePrefix: file.GeneratedFilenamePrefix, |
| 296 | } |
| 297 | |
| 298 | r.files[filePath] = f |
| 299 | r.registerMsg(f, nil, file.Proto.MessageType) |
| 300 | r.registerEnum(f, nil, file.Proto.EnumType) |
| 301 | } |
| 302 | |
| 303 | func (r *Registry) registerMsg(file *File, outerPath []string, msgs []*descriptorpb.DescriptorProto) { |
| 304 | for i, md := range msgs { |