(cacheFormatPath string)
| 478 | } |
| 479 | |
| 480 | func migrateCacheFormatJSON(cacheFormatPath string) error { |
| 481 | // now migrate format.json |
| 482 | f, err := os.OpenFile(cacheFormatPath, os.O_RDWR, 0o666) |
| 483 | if err != nil { |
| 484 | return err |
| 485 | } |
| 486 | defer f.Close() |
| 487 | formatV1 := formatCacheV1{} |
| 488 | if err := jsonLoad(f, &formatV1); err != nil { |
| 489 | return err |
| 490 | } |
| 491 | |
| 492 | formatV2 := &formatCacheV2{} |
| 493 | formatV2.formatMetaV1 = formatV1.formatMetaV1 |
| 494 | formatV2.Version = formatMetaVersion1 |
| 495 | formatV2.Cache = formatV1.Cache |
| 496 | formatV2.Cache.Version = formatCacheVersionV2 |
| 497 | return jsonSave(f, formatV2) |
| 498 | } |
no test coverage detected