github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/fs/fs.go (about) 1 // Package fs contain file system helpers 2 package fs 3 4 import ( 5 "fmt" 6 "os" 7 ) 8 9 func EnsureDirExists(dir string) error { 10 if dir == "" { 11 return nil 12 } 13 14 if err := os.MkdirAll(dir, os.ModeDir|os.ModePerm); err != nil { 15 return fmt.Errorf("could not create directory '%s': %w", dir, err) 16 } 17 18 return nil 19 }