@@ -110,7 +110,11 @@ function! go#lint#Gometa(bang, autosave, ...) abort
110
110
" Parse and populate our location list
111
111
112
112
if a: autosave
113
- call s: metalinterautosavecomplete (l: metalinter , fnamemodify (expand (' %:p' ), ' :.' ), 0 , 1 , l: messages )
113
+ if l: metalinter == ' golangci-lint'
114
+ call s: metalinterautosavecomplete (l: metalinter , expand (' %:p' ), 0 , 1 , l: messages )
115
+ elseif l: metalinter == ' staticcheck'
116
+ call s: metalinterautosavecomplete (l: metalinter , fnamemodify (expand (' %:p' ), ' :.' ), 0 , 1 , l: messages )
117
+ endif
114
118
endif
115
119
call go#list#ParseFormat (l: listtype , l: errformat , l: messages , l: for , s: preserveerrors (a: autosave , l: listtype ))
116
120
@@ -396,7 +400,11 @@ function! s:lint_job(metalinter, args, bang, autosave)
396
400
if a: autosave
397
401
let l: opts .for = ' GoMetaLinterAutoSave'
398
402
" s:metalinterautosavecomplete is needed for staticcheck and golangci-lint
399
- let l: opts .complete = funcref (' s:metalinterautosavecomplete' , [a: metalinter , expand (' %:p:t' )])
403
+ if a: metalinter == ' golangci-lint'
404
+ let l: opts .complete = funcref (' s:metalinterautosavecomplete' , [a: metalinter , expand (' %:p' )])
405
+ elseif a: metalinter == ' staticcheck'
406
+ let l: opts .complete = funcref (' s:metalinterautosavecomplete' , [a: metalinter , expand (' %:p:t' )])
407
+ endif
400
408
let l: opts .preserveerrors = funcref (' s:preserveerrors' , [a: autosave ])
401
409
endif
402
410
@@ -448,6 +456,8 @@ function! s:metalinterautosavecomplete(metalinter, filepath, job, exit_code, mes
448
456
return
449
457
endif
450
458
459
+ let l: pathRE = printf (' ^%s:' , a: filepath )
460
+
451
461
let l: idx = 0
452
462
for l: item in a: messages
453
463
" leave in any messages that report errors about a:filepath or that report
@@ -460,7 +470,6 @@ function! s:metalinterautosavecomplete(metalinter, filepath, job, exit_code, mes
460
470
"
461
471
" golangci-lint may provide a relative path to the file, so allow that,
462
472
" too.
463
- let l: pathRE = printf (' ^\%%(\.%s\)\?%s' , go#util#PathSep (), a: filepath )
464
473
if (l: item = ~# l: pathRE && l: item !~# l: pathRE . ' :\d\+: : # ' ) || (a: metalinter == ' golangci-lint' && l: item = ~# ' ^level=' )
465
474
let l: idx += 1
466
475
continue
0 commit comments