Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes govet linter for go 1.13+, with tests #3191

Merged
merged 1 commit into from
Aug 7, 2020
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
5 changes: 4 additions & 1 deletion autoload/ale/handlers/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"
" Author: Ben Paxton <[email protected]>
" Description: moved to generic Golang file from govet
"
" Author: mostfunkyduck <[email protected]>
" Description: updated to work with go 1.14

function! ale#handlers#go#Handler(buffer, lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$'
let l:pattern = '\v^%(vet: )?([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$'
let l:output = []
let l:dir = expand('#' . a:buffer . ':p:h')

Expand Down
16 changes: 16 additions & 0 deletions test/handler/test_go_generic_handler.vader
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,24 @@ Execute(The golang handler should return the correct filenames):
\ 'type': 'E',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/other.go'),
\ },
\ {
\ 'lnum': 18,
\ 'col': 0,
\ 'text': 'random error',
\ 'type': 'E',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/go1.14.go'),
\ },
\ {
\ 'lnum': 36,
\ 'col': 2,
\ 'text': 'another random error',
\ 'type': 'E',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/anothergo1.14.go'),
\ },
\ ],
\ ale#handlers#go#Handler(bufnr(''), [
\ 'test.go:27: some error',
\ 'other.go:27:5: some error with a column',
\ 'vet: go1.14.go:18:0: random error',
\ 'vet: anothergo1.14.go:36:2: another random error',
\ ])