commit b00771ca14ef0b07a1eb6cf71e2511e12b02d0b0
parent c3931ef748d1bb0ec60e45e1cecdfc1bde850bfc
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Mon, 23 Nov 2015 22:35:54 +0100
Simplify ExtractRootPaths
Diffstat:
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/helpers/path.go b/helpers/path.go
@@ -458,13 +458,11 @@ func ExtractRootPaths(paths []string) []string {
r := make([]string, len(paths))
for i, p := range paths {
root := filepath.ToSlash(p)
- if strings.Contains(root, "/") {
- sections := strings.Split(root, "/")
- for _, section := range sections {
- if section != "" {
- root = section
- break
- }
+ sections := strings.Split(root, "/")
+ for _, section := range sections {
+ if section != "" {
+ root = section
+ break
}
}
r[i] = root