Skip to content

Commit

Permalink
Properly use exepath for CheckBinPath (#864)
Browse files Browse the repository at this point in the history
* Properly use exepath for CheckBinPath

 #823 added this the wrong way, it was reverted back on 9f0cf00 but still not achieving the right functionality. This uses it properly now, also adding it to how we lookup goimports for srcdir support.
  • Loading branch information
luan authored and fatih committed Jun 1, 2016
1 parent b25dbfb commit a9611d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autoload/go/fmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function! go#fmt#Format(withGoimport)

" get the command first so we can test it
let fmt_command = g:go_fmt_command
if a:withGoimport == 1
if a:withGoimport == 1
let fmt_command = g:go_goimports_bin
endif

Expand All @@ -109,13 +109,13 @@ function! go#fmt#Format(withGoimport)

" populate the final command with user based fmt options
let command = fmt_command . ' -w '
if a:withGoimport != 1
if a:withGoimport != 1
let command = command . g:go_fmt_options
endif

if fmt_command == "goimports"
if !exists('b:goimports_vendor_compatible')
let out = go#util#System("goimports --help")
let out = go#util#System(bin_path . " --help")
if out !~ "-srcdir"
call go#util#EchoWarning("vim-go: goimports does not support srcdir. update with: :GoUpdateBinaries")
else
Expand Down
3 changes: 3 additions & 0 deletions autoload/go/path.vim
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ function! go#path#CheckBinPath(binpath)

" if it's in PATH just return it
if executable(binpath)
if v:version == 704 && has('patch235')
let binpath = exepath(binpath)
endif
let $PATH = old_path
return binpath
endif
Expand Down

0 comments on commit a9611d7

Please sign in to comment.