File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,18 @@ function! go#tool#FilterValids(items) abort
162
162
endfunction
163
163
164
164
function ! go#tool#ExecuteInDir (cmd) abort
165
+ " Verify that the directory actually exists. If the directory does not
166
+ " exist, then assume that the a:cmd should not be executed. Callers expect
167
+ " to check v:shell_error (via go#util.ShellError()), so execute a command
168
+ " that will return an error as if a:cmd was run and exited with an error.
169
+ " This helps avoid errors when working with plugins that use virtual files
170
+ " that don't actually exist on the file system (e.g. vim-fugitive's
171
+ " GitDiff).
172
+ if ! isdirectory (expand (" %:p:h" ))
173
+ let out = go#util#System (" exit 1" )
174
+ return out
175
+ endif
176
+
165
177
let old_gopath = $GOPATH
166
178
let old_goroot = $GOROOT
167
179
let $GOPATH = go#path#Detect ()
You can’t perform that action at this time.
0 commit comments