mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins
This commit is contained in:
@ -27,6 +27,10 @@ function! SyntaxCheckers_go_go_IsAvailable() dict
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_go_go_GetLocList() dict
|
||||
if !exists('s:go_new')
|
||||
let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5])
|
||||
endif
|
||||
|
||||
" Check with gofmt first, since `go build` and `go test` might not report
|
||||
" syntax errors in the current file if another file with syntax error is
|
||||
" compiled first.
|
||||
@ -51,15 +55,15 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||
" compiled by `go build`, therefore `go test` must be called for those.
|
||||
if match(expand('%', 1), '\m_test\.go$') == -1
|
||||
let cmd = 'build'
|
||||
let opts = syntastic#util#var('go_go_build_args')
|
||||
let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '')
|
||||
let cleanup = 0
|
||||
else
|
||||
let cmd = 'test -c'
|
||||
let opts = syntastic#util#var('go_go_test_args')
|
||||
let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '')
|
||||
let cleanup = 1
|
||||
endif
|
||||
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
|
||||
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str
|
||||
let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str
|
||||
|
||||
" The first pattern is for warnings from C compilers.
|
||||
let errorformat =
|
||||
@ -67,6 +71,8 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||
\ '%E%f:%l:%c:%m,' .
|
||||
\ '%E%f:%l:%m,' .
|
||||
\ '%C%\s%\+%m,' .
|
||||
\ '%+Ecan''t load package: %m,' .
|
||||
\ '%+Einternal error: %m,' .
|
||||
\ '%-G#%.%#'
|
||||
|
||||
" The go compiler needs to either be run with an import path as an
|
||||
@ -77,6 +83,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h', 1),
|
||||
\ 'env': {'GOGC': 'off'},
|
||||
\ 'defaults': {'type': 'e'} })
|
||||
|
||||
if cleanup
|
||||
|
@ -0,0 +1,53 @@
|
||||
"============================================================================
|
||||
"File: gometalinter.vim
|
||||
"Description: Check go syntax using 'gometalint'
|
||||
"Maintainer: Joshua Rubin <joshua@rubixconsulting.com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_go_gometalinter_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_go_gometalinter_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_go_gometalinter_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '-t',
|
||||
\ 'fname': syntastic#util#shexpand('%:p:h') })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c:%trror: %m,' .
|
||||
\ '%f:%l:%c:%tarning: %m,' .
|
||||
\ '%f:%l::%trror: %m,' .
|
||||
\ '%f:%l::%tarning: %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
if e['text'] =~# '\v\(%(deadcode|gocyclo|golint|defercheck|varcheck|structcheck|errcheck|dupl)\)$'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'go',
|
||||
\ 'name': 'gometalinter'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
@ -19,7 +19,9 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_go_gotype_GetLocList() dict
|
||||
let makeprg = self.getExecEscaped() . ' .'
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''),
|
||||
\ 'fname': '.' })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c: %m,' .
|
||||
|
@ -23,7 +23,7 @@ function! SyntaxCheckers_go_govet_IsAvailable() dict
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_go_govet_GetLocList() dict
|
||||
let makeprg = self.getExec() . ' vet'
|
||||
let makeprg = self.getExecEscaped() . ' vet'
|
||||
|
||||
let errorformat =
|
||||
\ '%Evet: %.%\+: %f:%l:%c: %m,' .
|
||||
|
Reference in New Issue
Block a user