Remove unused function in download package
This commit is contained in:
@@ -237,22 +237,3 @@ func downloadFile(url, destPath string, onChunk func(int64)) (int64, error) {
|
|||||||
|
|
||||||
return total, nil
|
return total, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensureDir creates path and all parents if they don't exist.
|
|
||||||
func ensureDir(path string) error {
|
|
||||||
info, err := os.Stat(path)
|
|
||||||
if err == nil {
|
|
||||||
if !info.IsDir() {
|
|
||||||
return fmt.Errorf("path exists but is not a directory: %s", path)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if !os.IsNotExist(err) {
|
|
||||||
return fmt.Errorf("stat %s: %w", path, err)
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(path, 0o750); err != nil {
|
|
||||||
return fmt.Errorf("mkdir %s: %w", path, err)
|
|
||||||
}
|
|
||||||
logger.Info("download: created directory %s", path)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user