(ch *cmdutil.Helper, preset string, verbose, reset, refreshDotenv bool, services *servicesCfg)
| 97 | } |
| 98 | |
| 99 | func start(ch *cmdutil.Helper, preset string, verbose, reset, refreshDotenv bool, services *servicesCfg) error { |
| 100 | ctx := graceful.WithCancelOnTerminate(context.Background()) |
| 101 | |
| 102 | err := errors.Join( |
| 103 | checkGoVersion(), |
| 104 | checkNodeVersion(ctx), |
| 105 | checkDocker(ctx), |
| 106 | checkRillRepo(), |
| 107 | ) |
| 108 | if err != nil { |
| 109 | return err |
| 110 | } |
| 111 | |
| 112 | switch preset { |
| 113 | case "cloud", "minimal", "e2e", "other": |
| 114 | err = cloud{}.start(ctx, ch, verbose, reset, refreshDotenv, preset, services) |
| 115 | case "local": |
| 116 | err = local{}.start(ctx, verbose, reset, services) |
| 117 | default: |
| 118 | err = fmt.Errorf("unknown preset %q", preset) |
| 119 | } |
| 120 | // If ctx.Err() != nil, we don't return the err because any graceful shutdown will cause sub-commands to return non-zero exit code errors. |
| 121 | // In these cases, ignoring the error doesn't really matter since "real" errors are probably also logged to stdout anyway. |
| 122 | if err != nil && (ctx.Err() == nil || verbose) { |
| 123 | return err |
| 124 | } |
| 125 | return nil |
| 126 | } |
| 127 | |
| 128 | func checkGoVersion() error { |
| 129 | v := version.Must(version.NewVersion(strings.TrimPrefix(runtime.Version(), "go"))) |
no test coverage detected