(ctx context.Context, verbose, reset bool, services *servicesCfg)
| 634 | type local struct{} |
| 635 | |
| 636 | func (s local) start(ctx context.Context, verbose, reset bool, services *servicesCfg) error { |
| 637 | g, ctx := errgroup.WithContext(ctx) |
| 638 | |
| 639 | if services.runtime { |
| 640 | g.Go(func() error { return s.runRuntime(ctx, verbose, reset) }) |
| 641 | } |
| 642 | |
| 643 | runtimeReadyCh := make(chan struct{}) |
| 644 | g.Go(func() error { |
| 645 | if services.runtime { |
| 646 | err := s.awaitRuntime(ctx) |
| 647 | if err != nil { |
| 648 | return err |
| 649 | } |
| 650 | } |
| 651 | close(runtimeReadyCh) |
| 652 | return nil |
| 653 | }) |
| 654 | |
| 655 | if services.ui { |
| 656 | npmReadyCh := make(chan struct{}) |
| 657 | g.Go(func() error { |
| 658 | err := s.runUIInstall(ctx) |
| 659 | if err != nil { |
| 660 | return err |
| 661 | } |
| 662 | close(npmReadyCh) |
| 663 | return nil |
| 664 | }) |
| 665 | |
| 666 | g.Go(func() error { |
| 667 | if err := awaitClose(ctx, runtimeReadyCh, npmReadyCh); err != nil { |
| 668 | return err |
| 669 | } |
| 670 | return s.runUI(ctx) |
| 671 | }) |
| 672 | } |
| 673 | |
| 674 | uiReadyCh := make(chan struct{}) |
| 675 | g.Go(func() error { |
| 676 | if services.ui { |
| 677 | err := s.awaitUI(ctx) |
| 678 | if err != nil { |
| 679 | return err |
| 680 | } |
| 681 | } |
| 682 | close(uiReadyCh) |
| 683 | return nil |
| 684 | }) |
| 685 | |
| 686 | g.Go(func() error { |
| 687 | // Wait for runtime, then UI |
| 688 | if err := awaitClose(ctx, runtimeReadyCh, uiReadyCh); err != nil { |
| 689 | return err |
| 690 | } |
| 691 | logInfo.Printf("All services ready\n") |
| 692 | return nil |
| 693 | }) |
nothing calls this directly
no test coverage detected