aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/go.vim
blob: ac5373082d335a1552f8aa8ddb0679dcb278b18f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
" vim: ts=4 sw=4 et

function! neomake#makers#ft#go#EnabledMakers() abort
    let makers = ['go']
    if executable('golangci-lint')
        call add(makers, 'golangci_lint')
    elseif executable('gometalinter')
        call add(makers, 'gometalinter')
    else
        call extend(makers, ['golint', 'govet'])
    endif
    return makers
endfunction

function! neomake#makers#ft#go#go() abort
    return {
        \ 'args': [
            \ 'test', '-c',
            \ '-o', g:neomake#compat#dev_null,
        \ ],
        \ 'append_file': 0,
        \ 'cwd': '%:h',
        \ 'serialize': 1,
        \ 'serialize_abort_on_error': 1,
        \ 'errorformat':
            \ '%W%f:%l: warning: %m,' .
            \ '%E%f:%l:%c:%m,' .
            \ '%E%f:%l:%m,' .
            \ '%C%\s%\+%m,' .
            \ '%-G%.%#\\\[no test files],' .
            \ '%-G#%.%#',
        \ 'postprocess': function('neomake#postprocess#compress_whitespace'),
        \ 'version_arg': 'version',
        \ }
endfunction

function! neomake#makers#ft#go#golint() abort
    " golint's issues are informational, as they're stylistic (not bugs)
    return {
        \ 'errorformat':
            \ '%I%f:%l:%c: %m,' .
            \ '%-G%.%#'
        \ }
endfunction

function! neomake#makers#ft#go#govet() abort
    return {
        \ 'exe': 'go',
        \ 'args': ['vet'],
        \ 'append_file': 0,
        \ 'cwd': '%:h',
        \ 'errorformat':
            \ '%Evet: %.%\+: %f:%l:%c: %m,' .
            \ '%W%f:%l: %m,' .
            \ '%-G%.%#'
        \ }
endfunction

function! neomake#makers#ft#go#gometalinter() abort
    " Only run a subset of gometalinter for speed, users can override with:
    " let g:neomake_go_gometalinter_args = ['--disable-all', '--enable=X', ...]
    "
    " All linters are only warnings, the go compiler will report errors
    return {
        \ 'args': ['--disable-all', '--enable=errcheck', '--enable=megacheck', '--vendor'],
        \ 'append_file': 0,
        \ 'cwd': '%:h',
        \ 'errorformat':
            \ '%f:%l:%c:%t%*[^:]: %m,' .
            \ '%f:%l::%t%*[^:]: %m'
        \ }
endfunction

function! neomake#makers#ft#go#golangci_lint() abort
    return {
        \ 'exe': 'golangci-lint',
        \ 'args': ['run', '--out-format=line-number', '--print-issued-lines=false'],
        \ 'output_stream': 'stdout',
        \ 'append_file': 0,
        \ 'cwd': '%:h',
        \ 'errorformat':
            \ '%f:%l:%c: %m'
        \ }
endfunction