Do executes this workflow.
(env *envp.Env)
| 24 | |
| 25 | // Do executes this workflow. |
| 26 | func (f Use) Do(env *envp.Env) { |
| 27 | ctx := logr.NewContext(context.TODO(), env.Log.WithName("use")) |
| 28 | env.EnsureBaseDirs(ctx) |
| 29 | if f.UseEnv { |
| 30 | // the env var unconditionally |
| 31 | if env.PathMatches(f.AssetsPath) { |
| 32 | env.PrintInfo(f.PrintFormat) |
| 33 | return |
| 34 | } |
| 35 | } |
| 36 | env.EnsureVersionIsSet(ctx) |
| 37 | if env.ExistsAndValid() { |
| 38 | env.PrintInfo(f.PrintFormat) |
| 39 | return |
| 40 | } |
| 41 | if env.NoDownload { |
| 42 | envp.Exit(2, "no such version (%s) exists on disk for this architecture (%s) -- try running `list -i` to see what's on disk", env.Version, env.Platform) |
| 43 | } |
| 44 | env.Fetch(ctx) |
| 45 | env.PrintInfo(f.PrintFormat) |
| 46 | } |
| 47 | |
| 48 | // List is a workflow that lists version-platform pairs in the store |
| 49 | // and on the remote server that match the given filter. |
no test coverage detected