diff options
author | Richard Jonas <richard.jonas.76@gmail.com> | 2022-05-04 13:05:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 20:05:32 +0900 |
commit | 9e1351499c6b9a43a5fddd535f82605bde237e5e (patch) | |
tree | cbe4ebeca2b74681db7291a0b10d8c03212c3aad /ale_linters/go | |
parent | 4e6a7debb444d702d12a9ee8b135c1c4ad09ff0a (diff) | |
download | ale-9e1351499c6b9a43a5fddd535f82605bde237e5e.zip |
Handle golangci_lint warning and error messages correctly (#4182)
* Handle golangci_lint warning and error messages correctly
* Fix linter warning
Co-authored-by: Richard Jonas <richard.jonas@derivco.se>
Diffstat (limited to 'ale_linters/go')
-rw-r--r-- | ale_linters/go/golangci_lint.vim | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ale_linters/go/golangci_lint.vim b/ale_linters/go/golangci_lint.vim index 2c4b1a4f..80431b99 100644 --- a/ale_linters/go/golangci_lint.vim +++ b/ale_linters/go/golangci_lint.vim @@ -24,7 +24,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort endfunction function! ale_linters#go#golangci_lint#GetMatches(lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$' + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)\s+\((.+)\)$' return ale#util#GetMatches(a:lines, l:pattern) endfunction @@ -34,14 +34,20 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort let l:output = [] for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines) + if l:match[5] is# 'typecheck' + let l:msg_type = 'E' + else + let l:msg_type = 'W' + endif + " l:match[1] will already be an absolute path, output from " golangci_lint call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, - \ 'type': 'E', - \ 'text': l:match[4], + \ 'type': l:msg_type, + \ 'text': l:match[4] . ' (' . l:match[5] . ')', \}) endfor |