INNER CODE UNIT · Go
mountedPaths
offen/docker-volume-backup · cmd/backup/config.go:370
func mountedPaths(path string) (map[string]struct{}, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer func() { _ = file.Close() }()
mounts := make(map[string]struct{})
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
parts := strings.SplitN(line, " - ", 2)
fields := strings.Fields(parts[0])
if len(fields) < 5 {
continue
}
mounts[fields[4]] = struct{}{}