clean dead codes
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func ExpandPaths(patterns []string) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
for _, pattern := range patterns {
|
||||
matches, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, m := range matches {
|
||||
info, err := os.Stat(m)
|
||||
if err != nil || info.IsDir() {
|
||||
continue
|
||||
}
|
||||
result = append(result, m)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
// "strings"
|
||||
)
|
||||
|
||||
func ExpandGlob(patterns []string) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
for _, pattern := range patterns {
|
||||
|
||||
if pattern == "*" {
|
||||
files, err := filepath.Glob("**") // fallback
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = append(result, files...)
|
||||
continue
|
||||
}
|
||||
|
||||
matches, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, m := range matches {
|
||||
info, err := os.Stat(m)
|
||||
if err != nil || info.IsDir() {
|
||||
continue
|
||||
}
|
||||
result = append(result, m)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func add(path string, seen map[string]struct{}, result *[]string) {
|
||||
if _, ok := seen[path]; ok {
|
||||
return
|
||||
}
|
||||
seen[path] = struct{}{}
|
||||
*result = append(*result, path)
|
||||
}
|
||||
Reference in New Issue
Block a user