Skip to content

Commit

Permalink
Merge pull request #702 from nhooyr/efficient-goroot
Browse files Browse the repository at this point in the history
go#package#Paths more efficient at getting GOROOT
  • Loading branch information
fatih committed Jan 28, 2016
2 parents 4c485a2 + a8d44df commit a1cfa11
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions autoload/go/package.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ endif
function! go#package#Paths()
let dirs = []

if executable('go')
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
if v:shell_error
echomsg '''go env GOROOT'' failed'
if !exists("s:goroot")
if executable('go')
let s:goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
if v:shell_error
echomsg '''go env GOROOT'' failed'
endif
else
let s:goroot = $GOROOT
endif
else
let goroot = $GOROOT
endif

if len(goroot) != 0 && isdirectory(goroot)
let dirs += [goroot]
if len(s:goroot) != 0 && isdirectory(s:goroot)
let dirs += [s:goroot]
endif

let workspaces = split($GOPATH, go#util#PathListSep())
Expand Down

0 comments on commit a1cfa11

Please sign in to comment.