Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Add syntax_checkers golangci_lint.vim #2190

Merged
merged 2 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/syntastic-checkers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2516,6 +2516,7 @@ The following checkers are available for Go (filetype "go"):
4. Go Meta Linter...........|syntastic-go-gometalinter|
5. gotype...................|syntastic-go-gotype|
6. vet......................|syntastic-go-govet|
7. golangci-lint............|syntastic-go-golangci-lint|

------------------------------------------------------------------------------
1. go *syntastic-go-go*
Expand Down Expand Up @@ -2620,6 +2621,16 @@ Note~
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
the usual 'g:syntastic_go_govet_<option>' variables.

------------------------------------------------------------------------------
7. golangci-lint *syntastic-go-golangci-lint*

Name: golangci-lint
Maintainer: Elvis Macak <elvis@lnmpy.com>

See the tool's documentation for details:

https://github.com/golangci/golangci-lint

==============================================================================
SYNTAX CHECKERS FOR HAML *syntastic-checkers-haml*

Expand Down
46 changes: 46 additions & 0 deletions syntax_checkers/go/golangci_lint.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"============================================================================
"File: golangci_lint.vim
"Description: Check go syntax using 'golangci-lint'
"Maintainer: Hiroshi Ioka <elvis@lnmpy.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_golangci_lint_checker')
finish
endif
let g:loaded_syntastic_go_golangci_lint_checker = 1

let s:save_cpo = &cpo
set cpo&vim

function! SyntaxCheckers_go_golangci_lint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': 'run',
\ })

let errorformat =
\ '%f:%l:%c: %m,' .
\ '%-G%.%#'

return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'},
\ 'subtype': 'Style' })

endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'golangci_lint',
\ 'exec': 'golangci-lint' })

let &cpo = s:save_cpo
unlet s:save_cpo

" vim: set sw=4 sts=4 et fdm=marker: