open-consul/consul/util.go

25 lines
395 B
Go
Raw Normal View History

2013-12-12 19:07:14 +00:00
package consul
2013-12-19 22:18:55 +00:00
import (
"os"
"path/filepath"
)
2013-12-12 19:07:14 +00:00
// strContains checks if a list contains a string
func strContains(l []string, s string) bool {
for _, v := range l {
if v == s {
return true
}
}
return false
}
2013-12-19 22:18:55 +00:00
// ensurePath is used to make sure a path exists
func ensurePath(path string, dir bool) error {
if !dir {
path = filepath.Dir(path)
}
return os.MkdirAll(path, 0755)
}