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

Update plugins using update_plugins.py

This commit is contained in:
Geezus
2019-07-08 11:44:45 -05:00
parent a25315c274
commit 0502b849ed
115 changed files with 3723 additions and 1662 deletions

View File

@ -20,19 +20,19 @@ function! s:checkVersion() abort
let l:unsupported = 0
if go#config#VersionWarning() != 0
if has('nvim')
let l:unsupported = !has('nvim-0.3.1')
let l:unsupported = !has('nvim-0.3.2')
else
let l:unsupported = (v:version < 704 || (v:version == 704 && !has('patch2009')))
endif
if l:unsupported == 1
echohl Error
echom "vim-go requires Vim 7.4.2009 or Neovim 0.3.1, but you're using an older version."
echom "vim-go requires Vim 7.4.2009 or Neovim 0.3.2, but you're using an older version."
echom "Please update your Vim for the best vim-go experience."
echom "If you really want to continue you can set this to make the error go away:"
echom " let g:go_version_warning = 0"
echom "Note that some features may error out or behave incorrectly."
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer or Neovim 0.3.1."
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer or Neovim 0.3.2."
echohl None
" Make sure people see this.
@ -56,7 +56,7 @@ let s:packages = {
\ 'gogetdoc': ['github.com/zmb3/gogetdoc'],
\ 'goimports': ['golang.org/x/tools/cmd/goimports'],
\ 'golint': ['golang.org/x/lint/golint'],
\ 'gopls': ['golang.org/x/tools/cmd/gopls'],
\ 'gopls': ['golang.org/x/tools/gopls@latest'],
\ 'gometalinter': ['github.com/alecthomas/gometalinter'],
\ 'golangci-lint': ['github.com/golangci/golangci-lint/cmd/golangci-lint'],
\ 'gomodifytags': ['github.com/fatih/gomodifytags'],
@ -104,9 +104,6 @@ function! s:GoInstallBinaries(updateBinaries, ...)
" vim's executable path is looking in PATH so add our go_bin path to it
let Restore_path = go#util#SetEnv('PATH', go_bin_path . go#util#PathListSep() . $PATH)
" GO111MODULE must be off to install golanci-lint and gometalinter
let Restore_modules = go#util#SetEnv('GO111MODULE', 'off')
" when shellslash is set on MS-* systems, shellescape puts single quotes
" around the output string. cmd on Windows does not handle single quotes
" correctly. Unsetting shellslash forces shellescape to use double quotes
@ -117,10 +114,7 @@ function! s:GoInstallBinaries(updateBinaries, ...)
set noshellslash
endif
let l:dl_cmd = ['go', 'get', '-v', '-d']
if get(g:, "go_get_update", 1) != 0
let l:dl_cmd += ['-u']
endif
let l:get_base_cmd = ['go', 'get', '-v']
" Filter packages from arguments (if any).
let l:packages = {}
@ -145,11 +139,9 @@ function! s:GoInstallBinaries(updateBinaries, ...)
for [binary, pkg] in items(l:packages)
let l:importPath = pkg[0]
let l:run_cmd = copy(l:dl_cmd)
if len(l:pkg) > 1 && get(l:pkg[1], l:platform, '') isnot ''
let l:run_cmd += get(l:pkg[1], l:platform, '')
endif
" TODO(bc): how to support this with modules? Do we have to clone and then
" install manually? Probably not. I suspect that we can just use GOPATH
" mode and then do the legacy method.
let bin_setting_name = "go_" . binary . "_bin"
if exists("g:{bin_setting_name}")
@ -169,24 +161,61 @@ function! s:GoInstallBinaries(updateBinaries, ...)
echo "vim-go: ". binary ." not found. Installing ". importPath . " to folder " . go_bin_path
endif
" first download the binary
let [l:out, l:err] = go#util#Exec(l:run_cmd + [l:importPath])
if l:err
echom "Error downloading " . l:importPath . ": " . l:out
if l:importPath =~ "@"
let Restore_modules = go#util#SetEnv('GO111MODULE', 'on')
let l:tmpdir = go#util#tempdir('vim-go')
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let l:dir = getcwd()
try
execute l:cd . fnameescape(l:tmpdir)
let l:get_cmd = copy(l:get_base_cmd)
" first download the binary
let [l:out, l:err] = go#util#Exec(l:get_cmd + [l:importPath])
if l:err
echom "Error installing " . l:importPath . ": " . l:out
endif
call call(Restore_modules, [])
finally
execute l:cd . fnameescape(l:dir)
endtry
call call(Restore_modules, [])
else
let l:get_cmd = copy(l:get_base_cmd)
let l:get_cmd += ['-d']
if get(g:, "go_get_update", 1) != 0
let l:get_cmd += ['-u']
endif
" GO111MODULE must be off to install gometalinter.
let Restore_modules = go#util#SetEnv('GO111MODULE', 'off')
" first download the binary
let [l:out, l:err] = go#util#Exec(l:get_cmd + [l:importPath])
if l:err
echom "Error downloading " . l:importPath . ": " . l:out
endif
" and then build and install it
let l:build_cmd = ['go', 'build', '-o', go_bin_path . go#util#PathSep() . bin, l:importPath]
if len(l:pkg) > 1 && get(l:pkg[1], l:platform, '') isnot ''
let l:build_cmd += get(l:pkg[1], l:platform, '')
endif
let [l:out, l:err] = go#util#Exec(l:build_cmd)
if l:err
echom "Error installing " . l:importPath . ": " . l:out
endif
call call(Restore_modules, [])
endif
" and then build and install it
let l:build_cmd = ['go', 'build', '-o', go_bin_path . go#util#PathSep() . bin, l:importPath]
let [l:out, l:err] = go#util#Exec(l:build_cmd)
if l:err
echom "Error installing " . l:importPath . ": " . l:out
endif
endif
endfor
" restore back!
call call(Restore_path, [])
call call(Restore_modules, [])
if resetshellslash
set shellslash