-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
util: add go#util#env function #954
Conversation
I had to add this hunk to get it working for :GoRename too: diff --git a/autoload/go/tool.vim b/autoload/go/tool.vim
index 487b933..fbbe12b 100644
--- a/autoload/go/tool.vim
+++ b/autoload/go/tool.vim
@@ -121,7 +121,9 @@ endfunction
function! go#tool#ExecuteInDir(cmd) abort
let old_gopath = $GOPATH
+ let old_goroot = $GOROOT
let $GOPATH = go#path#Detect()
+ let $GOROOT = go#util#env("goroot")
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
@@ -133,6 +135,7 @@ function! go#tool#ExecuteInDir(cmd) abort
endtry
let $GOPATH = old_gopath
+ let $GOROOT = old_goroot
return out
endfunction
Are there any other paths that might need it to? Edit: :GoDoc will need something similar it looks like. |
I'm not sure why |
I guess so - they seem to have problems if there's a syntax error. Trying to use
However addingthe fix-up into autoload/go/guru.vim didn't seem to help in this case. So maybe this won't work for all tools :( (My test is I last ran :GoUpdateBinaries with go 1.6.2 and this morning I upgraded to go 1.6.3) |
@FiloSottile can you try this PR and see if this fixes #901 ? |
Another ping @ashb @FiloSottile |
I think it makes sense to include the patch form #954 (comment) too - it helps for more of the tools, even if not every single one. |
@ashb good call, I've forget it. I'll try to add them. |
b9d03e8
to
ec79536
Compare
Add new function to return cached version of Go environment variables. With that set GOROOT everytime we execute gocode. This will prevent gocode using the internal embedded GOROOT and will use the GOROOT from the latest installed Go version. Fixes #901
ec79536
to
bae1529
Compare
@ashb sorry for the late response. But I've included your patch as well. Does this look good now? Can you try it? |
This is an improvment and fixes some of the tools, if not all of them. Lets merge it. (guru doesn't work because it doesn't call |
Add new function to return cached version of Go environment variables.
With that set GOROOT everytime we execute gocode. This will prevent
gocode using the internal embedded GOROOT and will use the GOROOT from
the latest installed Go version.
Fixes #901