add heapify
Some checks failed
Go Bump / bump (push) Successful in 55s
Go Test / build (push) Failing after 1m10s

This commit is contained in:
xuu
2025-09-22 16:41:55 -06:00
parent dfae0ddbcc
commit 36a10e319f
3 changed files with 61 additions and 0 deletions

View File

@@ -39,6 +39,17 @@ func setENV(name, value string) string {
func Get(base, suffix string) string {
return strings.Join(paths(base, suffix), string(os.PathListSeparator))
}
func GetRoot(base, suffix string, perm os.FileMode) (*os.Root, error) {
fs, err := os.OpenRoot(base)
if err != nil {
return nil, err
}
err = fs.Mkdir(Get(base, suffix), perm)
if err != nil {
return nil, err
}
return os.OpenRoot(Get(base, suffix))
}
func paths(base, suffix string) []string {
paths := strings.Split(os.ExpandEnv(base), string(os.PathListSeparator))
for i, path := range paths {