From 2b8f74f90c43d9bb1f70a86bb62680ac75ddc7e9 Mon Sep 17 00:00:00 2001 From: Mat Ryer Date: Tue, 11 Jul 2017 20:45:51 +0100 Subject: [PATCH] better path parsing --- pkg/moq/importer.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/moq/importer.go b/pkg/moq/importer.go index acf1225..1445459 100644 --- a/pkg/moq/importer.go +++ b/pkg/moq/importer.go @@ -67,6 +67,11 @@ func vendorPath(source, pkg string) (string, bool) { if isGopath(source) { return "", false } + var err error + source, err = filepath.Abs(source) + if err != nil { + return "", false + } vendorPath, err := filepath.Abs(path.Join(source, "vendor", pkg)) if err != nil { return "", false @@ -75,9 +80,6 @@ func vendorPath(source, pkg string) (string, bool) { return vendorPath, true } source = filepath.Dir(source) - if source == "." { - return "", false - } } }