Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go.mod automatically updated #15

Closed
tylerphelan opened this issue May 7, 2019 · 5 comments
Closed

go.mod automatically updated #15

tylerphelan opened this issue May 7, 2019 · 5 comments

Comments

@tylerphelan
Copy link

We're noticing that our go.mod file gets updated if we open a session inside a go mod project. The packages added are:

+ golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 // indirect
+ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
+ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b // indirect
+ golang.org/x/text v0.3.2 // indirect
+ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c // indirect

We think it has to do with installing vim-go with :InstallBinaries but we're not sure what's going on. When we set :let $GO111MODULE = 'off' in before.vim we don't get the updates to go.mod so it's trying to install something..

Have you seen behavior like this? Are we doing something wrong? Any help to get rid of the automatic go.mod updates would greatly appreciated!

@luan
Copy link
Owner

luan commented May 8, 2019

Do you have a minimal reproducible example repo I can play around with?

@Changdrew
Copy link

Changdrew commented May 8, 2019

We think this happens because

nvim/update.vim

Lines 42 to 45 in 6c7522a

function! update#installLanguageServers()
if executable('go')
call jobstart('go get -u golang.org/x/tools/cmd/gopls')
endif
runs on opening any go file. With the change to go mod, go get does different things. We (@vitreuz) tried to turn off auto-update through let g:skip_autoupdate = 1 but that didn't disable the updating.

@vitreuz
Copy link

vitreuz commented May 8, 2019

@luan here's an example repo

https://github.com/vitreuz/module-repro-bug

luan added a commit that referenced this issue May 9, 2019
@luan
Copy link
Owner

luan commented May 9, 2019

@Changdrew that logic was added before vim-go actually started installing gopls. I removed it now.

This issue is now only going to happen when running a fresh :GoInstallBinaries or :GoUpdateBinaries from a go mod project. So the problem is still present on vim-go.

I'm still looking at how we can mitigate it on this repo though it should be a bit better now.

luan added a commit that referenced this issue May 9, 2019
@luan
Copy link
Owner

luan commented May 9, 2019

Aand it looks like vim-go has actually already dealt with this.

I couldn't reproduce the problem with latest everything anymore so it seems like it may be fixed. Please re-open if this continues happening for you.

@luan luan closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants