(keys []string)
| 630 | } |
| 631 | |
| 632 | func buildDedupKeyInfos(keys []string) []cacheKeyInfo { |
| 633 | keyInfos := make([]cacheKeyInfo, len(keys)) |
| 634 | for i, key := range keys { |
| 635 | parts := strings.SplitN(key, "@", 2) |
| 636 | versionRef := "" |
| 637 | if len(parts) == 2 { |
| 638 | versionRef = parts[1] |
| 639 | } |
| 640 | keyInfos[i] = cacheKeyInfo{key: key, versionRef: versionRef} |
| 641 | } |
| 642 | slices.SortFunc(keyInfos, func(a, b cacheKeyInfo) int { |
| 643 | switch { |
| 644 | case semverutil.IsMorePreciseVersion(a.versionRef, b.versionRef): |
| 645 | return -1 |
| 646 | case semverutil.IsMorePreciseVersion(b.versionRef, a.versionRef): |
| 647 | return 1 |
| 648 | default: |
| 649 | return 0 |
| 650 | } |
| 651 | }) |
| 652 | return keyInfos |
| 653 | } |
| 654 | |
| 655 | func collectDedupRemovals(keyInfos []cacheKeyInfo) (string, []string, []string) { |
| 656 | keepVersion := keyInfos[0].versionRef |
no test coverage detected