...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package manifest
16
17 import (
18 "context"
19 "fmt"
20 )
21
22 func ResolveVersion(ctx context.Context, repo Repository, componentName string, channelName string) (string, error) {
23 channel, err := repo.LoadChannel(ctx, channelName)
24 if err != nil {
25 return "", err
26 }
27
28 version, err := channel.Latest(ctx, componentName)
29 if err != nil {
30 return "", err
31 }
32
33 if version == nil {
34 return "", fmt.Errorf("could not find latest version in channel %v", channelName)
35 }
36 return version.Version, nil
37 }
38
View as plain text