Skip to content

Commit

Permalink
Merge pull request #1366 from fatih/fix-multiple-src
Browse files Browse the repository at this point in the history
path: fix autp detecting of GOPATH for import paths with string 'src'
  • Loading branch information
fatih authored Jul 22, 2017
2 parents d98b80e + 02c5d8a commit e0e8032
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions autoload/go/path.vim
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ function! go#path#Detect() abort
" fetched from a customizable list. The user should define any new package
" management tool by it's own.

" src folder outside $GOPATH
let src_root = finddir("src", current_dir .";")
" src folders outside $GOPATH
let src_roots = finddir("src", current_dir .";", -1)

" for cases like GOPATH/src/foo/src/bar, pick up GOPATH/src instead of
" GOPATH/src/foo/src
let src_root = ""
if len(src_roots) > 0
let src_root = src_roots[-1]
endif

if !empty(src_root)
let src_path = fnamemodify(src_root, ':p:h:h') . go#util#PathSep()

Expand Down

0 comments on commit e0e8032

Please sign in to comment.