fix loader loader when run from gopath

This commit is contained in:
Ethan Mosbaugh
2018-08-23 12:12:31 -07:00
parent 1cf9131ae2
commit e113944027
3 changed files with 67 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ func NewLoader(target, r string, fSys fs.FileSystem) (Loader, error) {
return nil, fmt.Errorf("Not valid path: root='%s', loc='%s'\n", r, target)
}
if isRepoUrl(target) {
if !isLocalTarget(target, fSys) && isRepoUrl(target) {
return newGithubLoader(target, fSys)
}
@@ -73,3 +73,8 @@ func isValidLoaderPath(target, root string) bool {
func isRootLoaderPath(root string) bool {
return root == ""
}
// isLocalTarget checks if a file exists in the filesystem
func isLocalTarget(s string, fs fs.FileSystem) bool {
return fs.Exists(s)
}