Skip to content

Commit

Permalink
plugin: use go#util#Echo* functions
Browse files Browse the repository at this point in the history
Use go#util#Echo* functions instead of calling echom directly.
  • Loading branch information
bhcleek committed Aug 18, 2019
1 parent 7ffc4a0 commit 0392f11
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions plugin/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ function! s:checkVersion() abort
endif

if l:unsupported == 1
echohl Error
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.2."
echohl None
call go#util#EchoError([
\ 'vim-go requires Vim 7.4.2009 or Neovim 0.3.2, but you are using an older version.',
\ 'Please update your Vim for the best vim-go experience.',
\ 'If you really want to continue you can set this to make the error go away:',
\ ' let g:go_version_warning = 0',
\ 'Note that some features may error out or behave incorrectly.',
\ 'Please do not report bugs unless you are using Vim 7.4.2009 or newer or Neovim 0.3.2.',
\])

" Make sure people see this.
sleep 2
Expand Down Expand Up @@ -90,9 +90,7 @@ function! s:GoInstallBinaries(updateBinaries, ...)
endif

if go#path#Default() == ""
echohl Error
echomsg "vim.go: $GOPATH is not set and 'go env GOPATH' returns empty"
echohl None
call go#util#EchoError('vim.go: $GOPATH is not set and `go env GOPATH` returns empty')
return
endif

Expand Down Expand Up @@ -173,7 +171,7 @@ function! s:GoInstallBinaries(updateBinaries, ...)
" 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
call go#util#EchoError(printf('Error installing %s: %s', l:importPath, l:out))
endif

call call(Restore_modules, [])
Expand All @@ -194,7 +192,7 @@ function! s:GoInstallBinaries(updateBinaries, ...)
" 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
call go#util#EchoError(printf('Error downloading %s: %s', l:importPath, l:out))
endif

" and then build and install it
Expand All @@ -205,7 +203,7 @@ function! s:GoInstallBinaries(updateBinaries, ...)

let [l:out, l:err] = go#util#Exec(l:build_cmd)
if l:err
echom "Error installing " . l:importPath . ": " . l:out
call go#util#EchoError(printf('Error installing %s: %s', l:importPath, l:out))
endif


Expand Down Expand Up @@ -236,12 +234,12 @@ endfunction
" commands are available.
function! s:CheckBinaries()
if !executable('go')
echohl Error | echomsg "vim-go: go executable not found." | echohl None
call go#util#EchoError('go executable not found.')
return -1
endif

if !executable('git')
echohl Error | echomsg "vim-go: git executable not found." | echohl None
call go#util#EchoError('vim-go: git executable not found.')
return -1
endif
endfunction
Expand Down

0 comments on commit 0392f11

Please sign in to comment.