1
0
mirror of https://github.com/amix/vimrc synced 2025-07-05 07:25:00 +08:00

Update some plugins.

This commit is contained in:
Kurtis Moxley
2022-08-08 16:41:37 +08:00
parent f6ba361e3e
commit bbbedb5311
15 changed files with 204 additions and 79 deletions

View File

@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ['1.17','1.18']
go: ['1.18','1.19']
vim: ['vim-8.0', 'vim-8.2', 'nvim']
steps:
- name: setup Go

View File

@ -8,8 +8,14 @@ IMPROVEMENTS:
* Show diagnostics via go#tool#DescribeBalloon().
[[GH-3415]](https://github.com/fatih/vim-go/pull/3415)
[[GH-3417]](https://github.com/fatih/vim-go/pull/3417)
* Allow version of individual tools to be installed with `:GoUpdateBinaries`
and `:GoInstallBinaries` to be overridden by users.
[[GH-3435]](https://github.com/fatih/vim-go/pull/3435)
[[GH-3436]](https://github.com/fatih/vim-go/pull/3436)
BUG FIXES:
* Fix quoting of arguments when shell is set to pwsh on Windows.
[[GH-3422]](https://github.com/fatih/vim-go/pull/3422)
## v1.26 - (April 23, 2022)

View File

@ -1,4 +1,4 @@
FROM golang:1.18.1
FROM golang:1.19.0
RUN apt-get update -y --allow-insecure-repositories && \
apt-get install -y build-essential curl git libncurses5-dev python3-pip && \

View File

@ -28,9 +28,18 @@ function! Test_GoDebugStart_Errors() abort
let l:expected = [
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline in argument list; possibly missing comma or )'},
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
\]
let [l:goversion, l:err] = go#util#Exec(['go', 'env', 'GOVERSION'])
let l:goversion = split(l:goversion, "\n")[0]
if l:goversion < 'go1.19'
let expected = [
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
\ ]
endif
call setqflist([], 'r')
call assert_false(exists(':GoDebugStop'))

View File

@ -44,8 +44,8 @@ func! s:gometa(metalinter) abort
let actual = copy(getqflist())
endwhile
" sort the results, because golangci-lint seems to be returning the golint
" deprecation notice in a non-deterministic order.
" sort the results, because golangci-lint doesn't always return notices in
" a deterministic order.
call sort(l:actual)
call sort(l:expected)
@ -163,8 +163,8 @@ func! s:gometaautosave(metalinter, withList) abort
let l:actual = copy(getloclist(0))
endwhile
" sort the results, because golangci-lint seems to be returning the golint
" deprecation notice in a non-deterministic order.
" sort the results, because golangci-lint doesn't always return notices in
" a deterministic order.
call sort(l:actual)
call sort(l:expected)
@ -176,48 +176,47 @@ func! s:gometaautosave(metalinter, withList) abort
endtry
endfunc
func! Test_GometaGolangciLint_importabs() abort
call s:gometa_importabs('golangci-lint')
endfunc
func! s:gometa_importabs(metalinter) abort
let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint')
silent exe 'e! ' . $GOPATH . '/src/lint/golangci-lint/problems/importabs/problems.go'
try
let g:go_metalinter_command = a:metalinter
let expected = [
\ {'lnum': 3, 'bufnr': bufnr('%'), 'col': 8, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"/quux" imported but not used (typecheck)'},
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
\ ]
" clear the quickfix list
call setqflist([], 'r')
let g:go_metalinter_enabled = ['golint']
call go#lint#Gometa(0, 0)
let actual = getqflist()
let start = reltime()
while len(actual) == 0 && reltimefloat(reltime(start)) < 10
sleep 100m
let actual = copy(getqflist())
endwhile
" sort the results, because golangci-lint seems to be returning the golint
" deprecation notice in a non-deterministic order.
call sort(l:actual)
call sort(l:expected)
call gotest#assert_quickfix(actual, expected)
finally
call call(RestoreGOPATH, [])
unlet g:go_metalinter_enabled
unlet g:go_metalinter_command
endtry
endfunc
"func! Test_GometaGolangciLint_importabs() abort
" call s:gometa_importabs('golangci-lint')
"endfunc
"
"func! s:gometa_importabs(metalinter) abort
" let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint')
" silent exe 'e! ' . $GOPATH . '/src/lint/golangci-lint/problems/importabs/problems.go'
"
" try
" let g:go_metalinter_command = a:metalinter
"
" let expected = [
" \ {'lnum': 3, 'bufnr': bufnr('%'), 'col': 8, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"/quux" imported but not used (typecheck)'},
" \ ]
" " clear the quickfix list
" call setqflist([], 'r')
"
" let g:go_metalinter_enabled = ['revive', 'typecheck']
"
" call go#lint#Gometa(0, 0)
"
" let actual = getqflist()
" let start = reltime()
" while len(actual) == 0 && reltimefloat(reltime(start)) < 10
" sleep 100m
" let actual = copy(getqflist())
" endwhile
"
" " sort the results, because golangci-lint doesn't always return notices in
" " a deterministic order.
" call sort(l:actual)
" call sort(l:expected)
"
" call gotest#assert_quickfix(actual, expected)
" finally
" call call(RestoreGOPATH, [])
" unlet g:go_metalinter_enabled
" unlet g:go_metalinter_command
" endtry
"endfunc
"
"func! Test_GometaAutoSaveGolangciLint_importabs() abort
" call s:gometaautosave_importabs('golangci-lint')
"endfunc
@ -266,7 +265,6 @@ func! s:gometa_multiple(metalinter) abort
try
let g:go_metalinter_command = a:metalinter
let expected = [
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
\ ]
@ -274,7 +272,7 @@ func! s:gometa_multiple(metalinter) abort
" clear the quickfix list
call setqflist([], 'r')
let g:go_metalinter_enabled = ['revive']
let g:go_metalinter_enabled = ['revive', 'typecheck']
call go#lint#Gometa(0, 0)
@ -285,8 +283,8 @@ func! s:gometa_multiple(metalinter) abort
let actual = copy(getqflist())
endwhile
" sort the results, because golangci-lint seems to be returning the golint
" deprecation notice in a non-deterministic order.
" sort the results, because golangci-lint doesn't always return notices in
" a deterministic order.
call sort(l:actual)
call sort(l:expected)
@ -309,7 +307,6 @@ func! s:gometaautosave_multiple(metalinter) abort
try
let g:go_metalinter_command = a:metalinter
let expected = [
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
\ ]
@ -317,7 +314,7 @@ func! s:gometaautosave_multiple(metalinter) abort
" clear the location list
call setloclist(0, [], 'r')
let g:go_metalinter_autosave_enabled = ['golint']
let g:go_metalinter_autosave_enabled = ['revive', 'typecheck']
call go#lint#Gometa(0, 1)
@ -328,8 +325,8 @@ func! s:gometaautosave_multiple(metalinter) abort
let actual = copy(getloclist(0))
endwhile
" sort the results, because golangci-lint seems to be returning the golint
" deprecation notice in a non-deterministic order.
" sort the results, because golangci-lint doesn't always return notices in
" a deterministic order.
call sort(l:actual)
call sort(l:expected)
@ -455,6 +452,7 @@ func! Test_Lint_GOPATH() abort
compiler go
let expected = [
\ {'lnum': 1, 'bufnr': bufnr('%')+9, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'should have a package comment'},
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
\ ]
@ -492,6 +490,7 @@ func! Test_Lint_NullModule() abort
compiler go
let expected = [
\ {'lnum': 1, 'bufnr': bufnr('%')+9, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'should have a package comment'},
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
\ ]

View File

@ -48,8 +48,16 @@ endfunc
func! Test_GoTestCompilerError() abort
let expected = [
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'}
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline in argument list; possibly missing comma or )'}
\ ]
let [l:goversion, l:err] = go#util#Exec(['go', 'env', 'GOVERSION'])
let l:goversion = split(l:goversion, "\n")[0]
if l:goversion < 'go1.19'
let expected = [
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'}
\ ]
endif
call s:test('compilerror/compilerror_test.go', expected)
endfunc

View File

@ -298,7 +298,21 @@ endfunction
" Shelljoin returns a shell-safe string representation of arglist. The
" {special} argument of shellescape() may optionally be passed.
function! go#util#Shelljoin(arglist, ...) abort
" Preserve original shell. This needs to be kept in sync with how s:system
" sets shell.
let l:shell = &shell
try
if !go#util#IsWin() && executable('/bin/sh')
set shell=/bin/sh
endif
if go#util#IsWin()
if executable($COMSPEC)
let &shell = $COMSPEC
endif
endif
let ssl_save = &shellslash
set noshellslash
if a:0
@ -307,20 +321,12 @@ function! go#util#Shelljoin(arglist, ...) abort
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
finally
" Restore original values
let &shellslash = ssl_save
let &shell = l:shell
endtry
endfunction
fu! go#util#Shellescape(arg)
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
endf
" Shelllist returns a shell-safe representation of the items in the given
" arglist. The {special} argument of shellescape() may optionally be passed.
function! go#util#Shelllist(arglist, ...) abort
@ -328,9 +334,9 @@ function! go#util#Shelllist(arglist, ...) abort
let ssl_save = &shellslash
set noshellslash
if a:0
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
return map(copy(a:arglist), 'go#util#Shelljoin(v:val, ' . a:1 . ')')
endif
return map(copy(a:arglist), 'shellescape(v:val)')
return map(copy(a:arglist), 'go#util#Shelljoin(v:val)')
finally
let &shellslash = ssl_save
endtry

View File

@ -500,6 +500,9 @@ CTRL-t
supplied, then only the specified binaries will be installed. The default
is to install everything.
A specific version of a binary can be specified by appending Go's version
syntax to the binary name. e.g. `:GoInstallBinaries gopls@v0.9.1`.
Set |'g:go_get_update'| to disable updating dependencies.
*:GoUpdateBinaries*
@ -510,6 +513,9 @@ CTRL-t
supplied, then only the specified binaries will be updated. The default is
to update everything.
A specific version of a binary can be specified by appending Go's version
syntax to the binary name. e.g. `:GoUpdateBinaries gopls@v0.9.1`.
Set |'g:go_get_update'| to disable updating dependencies.
*:GoImplements*
@ -1989,7 +1995,7 @@ use different templates for different projects.
*'g:go_template_test_file'*
Like with |'g:go_template_file'|, this specifies the file to use for test
tempaltes. The template file should be under the `templates` folder,
templates. The template file should be under the `templates` folder,
alternatively absolute paths can be used, too. Checkout
|'g:go_template_autocreate'| for more info. By default, the
`hello_world_test.go` file is used.

View File

@ -113,11 +113,21 @@ function! s:GoInstallBinaries(updateBinaries, ...)
let l:packages = {}
if a:0 > 0
for l:bin in a:000
let l:version = substitute(l:bin, '.*@', '', '')
if l:version == l:bin
let l:version = ''
endif
let l:bin = substitute(l:bin, '@.*', '', '')
let l:pkg = get(s:packages, l:bin, [])
if len(l:pkg) == 0
call go#util#EchoError('unknown binary: ' . l:bin)
return
endif
if l:version isnot ''
let l:pkg[0] = substitute(l:pkg[0], '@\zs.*', l:version, '')
endif
let l:packages[l:bin] = l:pkg
endfor
else