Cleanup deletes the GnuPGHome if it passes Validate. It returns an error if the GnuPGHome does not pass Validate, or if the removal failed.
()
| 180 | // It returns an error if the GnuPGHome does not pass Validate, or if the |
| 181 | // removal failed. |
| 182 | func (d GnuPGHome) Cleanup() error { |
| 183 | if err := d.Validate(); err != nil { |
| 184 | return err |
| 185 | } |
| 186 | return os.RemoveAll(d.String()) |
| 187 | } |
| 188 | |
| 189 | // Validate ensures the GnuPGHome is a valid GnuPG home directory path. |
| 190 | // When validation fails, it returns a descriptive reason as error. |