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
}
// Removes content of given directory
// Removes content of given directory and then the directory itself
func removeDirectory(dir string) error {
d, err := os.Open(dir)
if err != nil {
@ -79,6 +79,12 @@ func removeDirectory(dir string) error {
return err
}
}
err = os.Remove(filepath.Join(dir))
if err != nil {
return err
}
return nil
}