NewMatchComparer returns MatchComparer. If all is true, NewMatchComparer always returns All, regardless to the value of ss. If all is false and ss is empty, NewMatchComparer returns DefaultStrict (not Default). Otherwise NewMatchComparer returns Ordered MatchComparer.
(all bool, ss []string)
| 40 | // If all is false and ss is empty, NewMatchComparer returns DefaultStrict (not Default). |
| 41 | // Otherwise NewMatchComparer returns Ordered MatchComparer. |
| 42 | func NewMatchComparer(all bool, ss []string) (platforms.MatchComparer, error) { |
| 43 | if all { |
| 44 | return platforms.All, nil |
| 45 | } |
| 46 | if len(ss) == 0 { |
| 47 | // return DefaultStrict, not Default |
| 48 | return platforms.DefaultStrict(), nil |
| 49 | } |
| 50 | op, err := NewOCISpecPlatformSlice(false, ss) |
| 51 | return platforms.Ordered(op...), err |
| 52 | } |
| 53 | |
| 54 | // NewOCISpecPlatformSlice returns a slice of ocispec.Platform |
| 55 | // If all is true, NewOCISpecPlatformSlice always returns an empty slice, regardless to the value of ss. |
no test coverage detected
searching dependent graphs…