()
| 168 | } |
| 169 | |
| 170 | func (cid *cidFile) Close() error { |
| 171 | if cid.file == nil { |
| 172 | return nil |
| 173 | } |
| 174 | _ = cid.file.Close() |
| 175 | |
| 176 | if cid.written { |
| 177 | return nil |
| 178 | } |
| 179 | if err := os.Remove(cid.path); err != nil && !errors.Is(err, os.ErrNotExist) { |
| 180 | return fmt.Errorf("failed to remove the CID file: %w", err) |
| 181 | } |
| 182 | |
| 183 | return nil |
| 184 | } |
| 185 | |
| 186 | func (cid *cidFile) Write(id string) error { |
| 187 | if cid.file == nil { |