Simplify ExtractRootPaths
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 23 Nov 2015 21:35:54 +0000 (22:35 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 23 Nov 2015 21:35:54 +0000 (22:35 +0100)
helpers/path.go

index 07d08fa69342868cad9f75815dfa0b71de849f98..7fb116a77636ea106325a99ba1df1140d6df954b 100644 (file)
@@ -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