module cannot be assumed to be functional yet. Do not call any functions on module.
( ctx context.Context, // This function must already be filtered to include only module files and must be sync.OnceValues wrapped! syncOnceValuesGetBucketWithStorageMatcherApplied func() (storage.ReadBucket, error), module Module, targetPaths []string, targetExcludePaths []string, protoFileTargetPath string, includePackageFiles bool, )
| 287 | // module cannot be assumed to be functional yet. |
| 288 | // Do not call any functions on module. |
| 289 | func newModuleReadBucketForModule( |
| 290 | ctx context.Context, |
| 291 | // This function must already be filtered to include only module files and must be sync.OnceValues wrapped! |
| 292 | syncOnceValuesGetBucketWithStorageMatcherApplied func() (storage.ReadBucket, error), |
| 293 | module Module, |
| 294 | targetPaths []string, |
| 295 | targetExcludePaths []string, |
| 296 | protoFileTargetPath string, |
| 297 | includePackageFiles bool, |
| 298 | ) (*moduleReadBucket, error) { |
| 299 | // TODO FUTURE: get these validations into a common place |
| 300 | if protoFileTargetPath != "" && (len(targetPaths) > 0 || len(targetExcludePaths) > 0) { |
| 301 | return nil, syserror.Newf("cannot set both protoFileTargetPath %q and either targetPaths %v or targetExcludePaths %v", protoFileTargetPath, targetPaths, targetExcludePaths) |
| 302 | } |
| 303 | if protoFileTargetPath != "" && normalpath.Ext(protoFileTargetPath) != ".proto" { |
| 304 | return nil, syserror.Newf("protoFileTargetPath %q is not a .proto file", protoFileTargetPath) |
| 305 | } |
| 306 | return &moduleReadBucket{ |
| 307 | getBucket: syncOnceValuesGetBucketWithStorageMatcherApplied, |
| 308 | module: module, |
| 309 | targetPaths: targetPaths, |
| 310 | targetPathMap: xslices.ToStructMap(targetPaths), |
| 311 | targetExcludePathMap: xslices.ToStructMap(targetExcludePaths), |
| 312 | protoFileTargetPath: protoFileTargetPath, |
| 313 | includePackageFiles: includePackageFiles, |
| 314 | }, nil |
| 315 | } |
| 316 | |
| 317 | func (b *moduleReadBucket) GetFile(ctx context.Context, path string) (File, error) { |
| 318 | fileInfo, err := b.StatFileInfo(ctx, path) |