NewBuildCacheFormat returns a Format for rendering using a Context
(source string, quiet bool)
| 24 | |
| 25 | // NewBuildCacheFormat returns a Format for rendering using a Context |
| 26 | func NewBuildCacheFormat(source string, quiet bool) Format { |
| 27 | switch source { |
| 28 | case TableFormatKey: |
| 29 | if quiet { |
| 30 | return DefaultQuietFormat |
| 31 | } |
| 32 | return Format(defaultBuildCacheTableFormat) |
| 33 | case RawFormatKey: |
| 34 | if quiet { |
| 35 | return `build_cache_id: {{.ID}}` |
| 36 | } |
| 37 | format := `build_cache_id: {{.ID}} |
| 38 | parent_id: {{.Parent}} |
| 39 | build_cache_type: {{.CacheType}} |
| 40 | description: {{.Description}} |
| 41 | created_at: {{.CreatedAt}} |
| 42 | created_since: {{.CreatedSince}} |
| 43 | last_used_at: {{.LastUsedAt}} |
| 44 | last_used_since: {{.LastUsedSince}} |
| 45 | usage_count: {{.UsageCount}} |
| 46 | in_use: {{.InUse}} |
| 47 | shared: {{.Shared}} |
| 48 | ` |
| 49 | return Format(format) |
| 50 | } |
| 51 | return Format(source) |
| 52 | } |
| 53 | |
| 54 | func buildCacheSort(buildCache []build.CacheRecord) { |
| 55 | sort.Slice(buildCache, func(i, j int) bool { |
no test coverage detected
searching dependent graphs…