27 lines
416 B
Go
27 lines
416 B
Go
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
|
|
} |