]> Sergey Matveev's repositories - path-extractor.git/blobdiff - extractor.go
gofmt all the code
[path-extractor.git] / extractor.go
index 69d4b95b7a2f2801050f9d32a35efb746fd2c7bc..b7be986ea6b3ab8bca8582b0c8d6af4c7bb06d8e 100644 (file)
@@ -2,29 +2,28 @@ package main
 
 import "regexp"
 
-
 func pathExtractor(input string) [][][]byte {
-    surroundRegex := "[^][ \\t:'\"]"
-    r := regexp.MustCompile("("+surroundRegex+"*[\\./]"+surroundRegex+"*)")
-    temp := [][][]byte{}
-    temp = r.FindAllSubmatch([]byte(input),-1)
-    return temp
+       surroundRegex := "[^][ \\t:'\"]"
+       r := regexp.MustCompile("(" + surroundRegex + "*[\\./]" + surroundRegex + "*)")
+       temp := [][][]byte{}
+       temp = r.FindAllSubmatch([]byte(input), -1)
+       return temp
 }
 
 func getAllMatches(input string) []string {
-    matches := [][][]byte{}
-    result := []string{}
-    s := string("")
-    matches = pathExtractor(input)
-    for _,match := range matches {
-        s = string(match[1])
-        if isDate(s) || isVersion(s) || isGitRange(s) || isGitInstruction(s) || containsInvalidString(s) || len(s)<=2 {
-            continue
-        }
-        if isGitPath(s) {
-            s = replaceGitPath(s)
-        }
-        result = append(result,s)
-    }
-    return result
+       matches := [][][]byte{}
+       result := []string{}
+       s := string("")
+       matches = pathExtractor(input)
+       for _, match := range matches {
+               s = string(match[1])
+               if isDate(s) || isVersion(s) || isGitRange(s) || isGitInstruction(s) || containsInvalidString(s) || len(s) <= 2 {
+                       continue
+               }
+               if isGitPath(s) {
+                       s = replaceGitPath(s)
+               }
+               result = append(result, s)
+       }
+       return result
 }