func filterUnwantedMounts(mounts []Mount) []Mount {
// Remove duplicates
- seen := make(map[Mount]bool)
+ seen := make(map[string]bool)
tmp := mounts[:0]
for _, m := range mounts {
- if !seen[m] {
+ if !seen[m.key()] {
tmp = append(tmp, m)
}
- seen[m] = true
+ seen[m.key()] = true
}
return tmp
}
import (
"fmt"
+ "path"
"path/filepath"
"strings"
ExcludeFiles interface{}
}
+// Used as key to remove duplicates.
+func (m Mount) key() string {
+ return path.Join(m.Lang, m.Source, m.Target)
+}
+
func (m Mount) Component() string {
return strings.Split(m.Target, fileSeparator)[0]
}