(fs billy.Filesystem, path string, v any)
| 1654 | } |
| 1655 | |
| 1656 | func writeMagicImageFile(fs billy.Filesystem, path string, v any) error { |
| 1657 | file, err := fs.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o644) |
| 1658 | if err != nil { |
| 1659 | return fmt.Errorf("create magic image file: %w", err) |
| 1660 | } |
| 1661 | defer file.Close() |
| 1662 | |
| 1663 | enc := json.NewEncoder(file) |
| 1664 | enc.SetIndent("", " ") |
| 1665 | if err := enc.Encode(v); err != nil { |
| 1666 | return fmt.Errorf("encode magic image file: %w", err) |
| 1667 | } |
| 1668 | |
| 1669 | return nil |
| 1670 | } |
| 1671 | |
| 1672 | func parseMagicImageFile(fs billy.Filesystem, path string, v any) error { |
| 1673 | file, err := fs.Open(path) |
no test coverage detected