all repos — vite @ e0dc7bd326a18d8004efd5b706b941b2265ad64b

a fast (this time, actually) and minimal static site generator

util/rmall.go (view raw)

 1package util
 2
 3import (
 4	"os"
 5	"path/filepath"
 6)
 7
 8// Cleans a given directory, removing all files and subdirs.
 9func Clean(dir string) error {
10	files, err := filepath.Glob(filepath.Join(dir, "*"))
11	if err != nil {
12		return err
13	}
14
15	for _, file := range files {
16		err = os.RemoveAll(file)
17		if err != nil {
18			return err
19		}
20	}
21	return nil
22}