Skip to content

Commit

Permalink
Merge pull request #883 from macb/get_update
Browse files Browse the repository at this point in the history
make go get -u configurable
  • Loading branch information
fatih committed Jun 3, 2016
2 parents 2112896 + 04a0faa commit e46c5ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ disabled/enabled easily.

## Install

Master branch is supposed to be a development branch. So stuff here can break and change.
Master branch is supposed to be a development branch. So stuff here can break and change.
Please try use always the [latest release](https://github.com/fatih/vim-go/releases/latest)

Vim-go follows the standard runtime path structure, so I highly recommend to
Expand Down Expand Up @@ -218,6 +218,11 @@ let g:go_bin_path = expand("~/.gotools")
let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path
```

Disable updating dependencies when installing/updating binaries:
```vim
let g:go_get_update = 0
```

### Using with Neovim (beta)

Note: Neovim currently is not a first class citizen for vim-go. You are free
Expand Down
11 changes: 10 additions & 1 deletion doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ CTRL-t
:GoInstallBinaries

Download and Install all necessary Go tool binaries such as `godef`,
`goimports`, `gocode`, etc.. under `g:go_bin_path`
`goimports`, `gocode`, etc.. under `g:go_bin_path`. Set |g:go_get_update|
to disable updating dependencies.

*:GoUpdateBinaries*
:GoUpdateBinaries
Expand Down Expand Up @@ -1035,6 +1036,14 @@ is used. Use "neosnippet" for neosnippet.vim: >
let g:go_snippet_engine = "ultisnips"
<

*'g:go_get_update'*

Use this option to disable updating dependencies with |GoInstallBinaries|. By
default this is enabled.
>
let g:go_get_update = 1
<

*'g:go_guru_scope'*

Use this option to define the scope of the analysis to be passed for guru
Expand Down
9 changes: 6 additions & 3 deletions plugin/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let g:go_loaded_install = 1
" needed by the user with GoInstallBinaries
let s:packages = [
\ "github.com/nsf/gocode",
\ "github.com/alecthomas/gometalinter",
\ "github.com/alecthomas/gometalinter",
\ "golang.org/x/tools/cmd/goimports",
\ "golang.org/x/tools/cmd/guru",
\ "golang.org/x/tools/cmd/gorename",
Expand Down Expand Up @@ -65,13 +65,16 @@ function! s:GoInstallBinaries(updateBinaries)
set noshellslash
endif

let cmd = "go get -u -v "
let cmd = "go get -v "
if get(g:, "go_get_update", 1) != 0
let cmd .= "-u "
endif

let s:go_version = matchstr(go#util#System("go version"), '\d.\d.\d')

" https://github.com/golang/go/issues/10791
if s:go_version > "1.4.0" && s:go_version < "1.5.0"
let cmd .= "-f "
let cmd .= "-f "
endif

for pkg in s:packages
Expand Down

0 comments on commit e46c5ef

Please sign in to comment.