diff options
| author | Femaref | 2018-01-20 12:23:24 +0100 |
|---|---|---|
| committer | Femaref | 2018-01-20 12:23:24 +0100 |
| commit | 33304658dfdfa29d25c00b274b97d01e0bfc4a88 (patch) | |
| tree | 8811a77f214b0c10eaecd2b28a4748f6ae42876e | |
| parent | 323d6b685948f2b2a3f9dee48222c3df510ab10f (diff) | |
| download | gomove-33304658dfdfa29d25c00b274b97d01e0bfc4a88.tar.bz2 | |
second try
| -rw-r--r-- | main.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -4,6 +4,7 @@ import ( "os" "path" "path/filepath" + "strings" "github.com/codegangsta/cli" ) @@ -52,13 +53,14 @@ func main() { // ScanDir scans a directory for go files and func ScanDir(dir string, from string, to string, c *cli.Context) { - // If from and to are not empty scan all files if from != "" && to != "" { + // construct the path of the vendor dir of the project for prefix matching + vendorDir := path.Join(dir, "vendor") // Scan directory for files filepath.Walk(dir, func(filePath string, info os.FileInfo, err error) error { // ignore vendor path - if matched, _ := path.Match("vendor/*", filePath); matched { + if matched := strings.HasPrefix(filePath, vendorDir); matched { return nil } // Only process go files |
