mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -63,10 +63,11 @@ function! go#lint#Gometa(autosave, ...) abort
|
||||
|
||||
let out = go#tool#ExecuteInDir(meta_command)
|
||||
|
||||
let l:listtype = "quickfix"
|
||||
if v:shell_error == 0
|
||||
redraw | echo
|
||||
call go#list#Clean()
|
||||
call go#list#Window()
|
||||
call go#list#Clean(l:listtype)
|
||||
call go#list#Window(l:listtype)
|
||||
echon "vim-go: " | echohl Function | echon "[metalinter] PASS" | echohl None
|
||||
else
|
||||
" GoMetaLinter can output one of the two, so we look for both:
|
||||
@ -76,13 +77,13 @@ function! go#lint#Gometa(autosave, ...) abort
|
||||
let errformat = "%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m"
|
||||
|
||||
" Parse and populate our location list
|
||||
call go#list#ParseFormat(errformat, split(out, "\n"))
|
||||
call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"))
|
||||
|
||||
let errors = go#list#Get()
|
||||
call go#list#Window(len(errors))
|
||||
let errors = go#list#Get(l:listtype)
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
|
||||
if !a:autosave
|
||||
call go#list#JumpToFirst()
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
@ -107,10 +108,11 @@ function! go#lint#Golint(...) abort
|
||||
return
|
||||
endif
|
||||
|
||||
call go#list#Parse(out)
|
||||
let errors = go#list#Get()
|
||||
call go#list#Window(len(errors))
|
||||
call go#list#JumpToFirst()
|
||||
let l:listtype = "quickfix"
|
||||
call go#list#Parse(l:listtype, out)
|
||||
let errors = go#list#Get(l:listtype)
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endfunction
|
||||
|
||||
" Vet calls 'go vet' on the current directory. Any warnings are populated in
|
||||
@ -123,17 +125,19 @@ function! go#lint#Vet(bang, ...)
|
||||
else
|
||||
let out = go#tool#ExecuteInDir('go tool vet ' . go#util#Shelljoin(a:000))
|
||||
endif
|
||||
|
||||
let l:listtype = "quickfix"
|
||||
if v:shell_error
|
||||
let errors = go#tool#ParseErrors(split(out, '\n'))
|
||||
call go#list#Populate(errors)
|
||||
call go#list#Window(len(errors))
|
||||
call go#list#Populate(l:listtype, errors)
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
if !empty(errors) && !a:bang
|
||||
call go#list#JumpToFirst()
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
echon "vim-go: " | echohl ErrorMsg | echon "[vet] FAIL" | echohl None
|
||||
else
|
||||
call go#list#Clean()
|
||||
call go#list#Window()
|
||||
call go#list#Clean(l:listtype)
|
||||
call go#list#Window(l:listtype)
|
||||
redraw | echon "vim-go: " | echohl Function | echon "[vet] PASS" | echohl None
|
||||
endif
|
||||
endfunction
|
||||
@ -159,21 +163,17 @@ function! go#lint#Errcheck(...) abort
|
||||
echon "vim-go: " | echohl Identifier | echon "errcheck analysing ..." | echohl None
|
||||
redraw
|
||||
|
||||
let command = bin_path . ' ' . goargs
|
||||
let command = bin_path . ' -abspath ' . goargs
|
||||
let out = go#tool#ExecuteInDir(command)
|
||||
|
||||
let l:listtype = "quickfix"
|
||||
if v:shell_error
|
||||
let errors = []
|
||||
let mx = '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)'
|
||||
for line in split(out, '\n')
|
||||
let tokens = matchlist(line, mx)
|
||||
if !empty(tokens)
|
||||
call add(errors, {"filename": expand(go#path#Default() . "/src/" . tokens[1]),
|
||||
\"lnum": tokens[2],
|
||||
\"col": tokens[3],
|
||||
\"text": tokens[4]})
|
||||
endif
|
||||
endfor
|
||||
let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m"
|
||||
|
||||
" Parse and populate our location list
|
||||
call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"))
|
||||
|
||||
let errors = go#list#Get(l:listtype)
|
||||
|
||||
if empty(errors)
|
||||
echohl Error | echomsg "GoErrCheck returned error" | echohl None
|
||||
@ -182,15 +182,15 @@ function! go#lint#Errcheck(...) abort
|
||||
endif
|
||||
|
||||
if !empty(errors)
|
||||
call go#list#Populate(errors)
|
||||
call go#list#Window(len(errors))
|
||||
call go#list#Populate(l:listtype, errors)
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
if !empty(errors)
|
||||
call go#list#JumpToFirst()
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
call go#list#Clean()
|
||||
call go#list#Window()
|
||||
call go#list#Clean(l:listtype)
|
||||
call go#list#Window(l:listtype)
|
||||
echon "vim-go: " | echohl Function | echon "[errcheck] PASS" | echohl None
|
||||
endif
|
||||
|
||||
|
Reference in New Issue
Block a user