From a9611d7d691994a1fd33821ce4220366d8711300 Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Wed, 1 Jun 2016 13:21:51 -0700 Subject: [PATCH] Properly use exepath for CheckBinPath (#864) * Properly use exepath for CheckBinPath #823 added this the wrong way, it was reverted back on 9f0cf00f6e9a437b738959f629ca29658334c6b5 but still not achieving the right functionality. This uses it properly now, also adding it to how we lookup goimports for srcdir support. --- autoload/go/fmt.vim | 6 +++--- autoload/go/path.vim | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/go/fmt.vim b/autoload/go/fmt.vim index 90afe72a3e..65303c91be 100644 --- a/autoload/go/fmt.vim +++ b/autoload/go/fmt.vim @@ -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 @@ -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 diff --git a/autoload/go/path.vim b/autoload/go/path.vim index 48f3269d88..8afe8f166e 100644 --- a/autoload/go/path.vim +++ b/autoload/go/path.vim @@ -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