@@ -154,10 +154,10 @@ function! go#cmd#Run(bang, ...) abort
154
154
155
155
call go#statusline#Update (expand (' %:p:h' ), l: status )
156
156
157
- let l: cmd = " go run "
157
+ let l: cmd = [ ' go ' , ' run' ]
158
158
let l: tags = go#config#BuildTags ()
159
159
if len (l: tags ) > 0
160
- let l: cmd .= " -tags " . go#util#Shellescape ( l: tags) . " "
160
+ let l: cmd = l: cmd + [ ' -tags' , l: tags]
161
161
endif
162
162
163
163
if a: 0 == 0
@@ -166,15 +166,19 @@ function! go#cmd#Run(bang, ...) abort
166
166
let l: files = map (copy (a: 000 ), " expand(v:val)" )
167
167
endif
168
168
169
- let l: cmd = printf ( ' %s%s ' , l: cmd, go#util#Shelljoin ( l: files, 1 ))
169
+ let l: cmd = l: cmd + l: files
170
170
171
171
let l: cd = exists (' *haslocaldir' ) && haslocaldir () ? ' lcd ' : ' cd '
172
172
let l: dir = getcwd ()
173
173
174
174
if go#util#IsWin ()
175
175
try
176
+ if go#util#HasDebug (' shell-commands' )
177
+ call go#util#EchoInfo (' shell command: ' . l: cmd )
178
+ endif
179
+
176
180
execute l: cd . fnameescape (expand (" %:p:h" ))
177
- exec printf (' !%s' , l: cmd )
181
+ exec printf (' !%s' , go#util#Shelljoin ( l: cmd, 1 ) )
178
182
finally
179
183
execute l: cd . fnameescape (l: dir )
180
184
endtry
@@ -199,7 +203,7 @@ function! go#cmd#Run(bang, ...) abort
199
203
200
204
" :make expands '%' and '#' wildcards, so they must also be escaped
201
205
let l: default_makeprg = &makeprg
202
- let &makeprg = l: cmd
206
+ let &makeprg = go#util#Shelljoin ( l: cmd, 1 )
203
207
204
208
let l: listtype = go#list#Type (" GoRun" )
205
209
@@ -209,6 +213,11 @@ function! go#cmd#Run(bang, ...) abort
209
213
" backup user's errorformat, will be restored once we are finished
210
214
let l: old_errorformat = &errorformat
211
215
let &errorformat = s: runerrorformat ()
216
+
217
+ if go#util#HasDebug (' shell-commands' )
218
+ call go#util#EchoInfo (' shell command: ' . l: cmd )
219
+ endif
220
+
212
221
execute l: cd . fnameescape (expand (" %:p:h" ))
213
222
if l: listtype == " locationlist"
214
223
exe ' lmake!'
0 commit comments