Skip to content

Commit

Permalink
write the file before using gocode in module mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Oct 19, 2018
1 parent 33af63d commit f24987d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions autoload/go/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ function! s:gocodeCommand(cmd, args) abort
let l:gocode_bin = "gocode"
let l:gomod = go#util#gomod()
if filereadable(l:gomod)
" Save the file when in module mode so that go list can read the
" imports. If the user doesn't have autowrite or autorwriteall enabled,
" they'll need to write the file manually to get reliable results.
" See https://github.com/fatih/vim-go/pull/1988#issuecomment-428576989.
"
" TODO(bc): don't save the file when in module mode once
" golang.org/x/tools/go/packages has support for an overlay and it's used
" by gocode.
call go#cmd#autowrite()
let l:gocode_bin = "gocode-gomod"
endif

Expand Down

0 comments on commit f24987d

Please sign in to comment.