(ctx context.Context, def *moduleDef)
| 479 | } |
| 480 | |
| 481 | func newModuleContext(ctx context.Context, def *moduleDef) (rctx moduleContext, rerr error) { |
| 482 | ctx, span := Tracer().Start(ctx, "getting more information from module source", telemetry.Internal()) |
| 483 | defer telemetry.EndWithCause(span, &rerr) |
| 484 | |
| 485 | if def.SourceKind == dagger.ModuleSourceKindLocalSource { |
| 486 | root, err := def.Source.LocalContextDirectoryPath(ctx) |
| 487 | if err != nil { |
| 488 | return nil, err |
| 489 | } |
| 490 | return localSourceContext{ |
| 491 | Root: root, |
| 492 | Path: def.SourceRootSubpath, |
| 493 | }, nil |
| 494 | } |
| 495 | |
| 496 | eg, gctx := errgroup.WithContext(ctx) |
| 497 | |
| 498 | var root string |
| 499 | var version string |
| 500 | var pin string |
| 501 | |
| 502 | eg.Go(func() error { |
| 503 | v, err := def.Source.CloneRef(gctx) |
| 504 | if err != nil { |
| 505 | return err |
| 506 | } |
| 507 | root = v |
| 508 | return nil |
| 509 | }) |
| 510 | |
| 511 | eg.Go(func() error { |
| 512 | v, err := def.Source.Version(gctx) |
| 513 | if err != nil { |
| 514 | return err |
| 515 | } |
| 516 | version = v |
| 517 | return nil |
| 518 | }) |
| 519 | |
| 520 | eg.Go(func() error { |
| 521 | v, err := def.Source.Commit(gctx) |
| 522 | if err != nil { |
| 523 | return err |
| 524 | } |
| 525 | pin = v |
| 526 | return nil |
| 527 | }) |
| 528 | |
| 529 | if err := eg.Wait(); err != nil { |
| 530 | return nil, err |
| 531 | } |
| 532 | |
| 533 | return gitSourceContext{ |
| 534 | Root: root, |
| 535 | Version: version, |
| 536 | Pin: pin, |
| 537 | Path: def.SourceRootSubpath, |
| 538 | }, nil |
no test coverage detected