Removing volume directory fix

Directory mounted in the container wasn't removed along the container
so we ended up with a lot of empty directories on the server.
This commit is contained in:
Adam Štrauch 2022-02-07 18:20:22 +01:00
parent 81b3d45a4b
commit c11de8a3e9
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -62,7 +62,7 @@ func du(path string) (int, int, error) {
return space, inodes, nil return space, inodes, nil
} }
// Removes content of given directory // Removes content of given directory and then the directory itself
func removeDirectory(dir string) error { func removeDirectory(dir string) error {
d, err := os.Open(dir) d, err := os.Open(dir)
if err != nil { if err != nil {
@ -79,6 +79,12 @@ func removeDirectory(dir string) error {
return err return err
} }
} }
err = os.Remove(filepath.Join(dir))
if err != nil {
return err
}
return nil return nil
} }