-
Notifications
You must be signed in to change notification settings - Fork 645
go.inferGopath does not work on opening a different folder #833
Comments
for
So if it doesn't change either |
Thanks for the explanation. But it doesn't seem to be behaving that way. I,m on OSX by the way. I just opened a file with the following path: /Users/xxx/ws/yyy/go/src/xxx/ondemand/service/tags/tags-server/version_data.go When I check the gopath, it is set to: Current GOPATH: /Users/xxx/ws/go It behaves erratically. I've seen it say "inferred path" and show the correct path at times. But when I change the folder back and forth a few times, the GOPATH does not change the way it should. I do open a file after opening a different folder. |
that is very strange, I am not unable to reproduce this. I have opened folders in the same gopath and separate gopath, still not able to reproduce this. I even tried with a new user account. Here is the code inferGoPath that handles this, its simple and straight enough to not contain any ambiguity. Maybe its a platform specific issue. BTW: the Anyone else reading this can you try with an OSX to confirm. |
All right, I ran the extension under the debugger, and it seems like what I didn't realize was that you were saying that the folder opened in It may help to point this out in the docs. Otherwise, you can resolve this one as a non issue. |
@ziffusion So if you were not opening a folder under |
@ramya-rao-a Well, a few things messed me up.
In any case, it would be good to clarify the behavior of this setting in the docs (for folks like me who don't have any context). Something like the following may work. If For example, if your project looks like Note that This setting is useful when you find yourself opening up different projects in |
@ziffusion Thats very well summed up, thanks a lot. I have used what you have written here in https://github.com/Microsoft/vscode-go/wiki/GOPATH-in-the-VS-Code-Go-extension and linked the wiki from the README @codmajik When there is no workspace opened and there is just a single file open in VS Code, we can still infer the GOPATH from the filepath. Thoughts? |
@ziffusion @ramya-rao-a, sure, we can infer from the filepath, I would push an update. Should this be configurable? |
Not sure if having it configurable is of value or not. I suppose, whatever makes things work well on the least-surprise principle, should be OK. So, how do you think that inferring from a file might work? At what point would the
Maybe, setting it once from the workspace, when a directory is opened in Another issue seems to be that the |
That is very strange, I don't use the debugger that much. inferGopath is part of the global GOPATH detection scheme. it is right where the effect of go.gopath and co are applied. |
So, this is when a person opens up a file in a window all by itself. What happens if he opens up another file in a different tab (but same window)?
Actually, I said that based on some docs you have on the wiki. It says there:
|
I initially thought we could have the GOPATH inferred from the file path only when there is no folder opened as in the file is open in a VS Code all by itself. But @ziffusion brings up a good point, we could have multiple Go files open, where would the GOPATH be inferred from? It would be better to leave this as is. i.e About the debugger not able to read user/workspace settings, I have logged #840 to dig a little deeper and get a better understanding regarding the why and how around the issue. Closing this issue as there are no action items left. Thanks for the great discussion though :) Happy Coding! |
go.inferGopath infers the GOPATH when you first open a folder in vscode. But then if you open a different folder, it does not infer the GOPATH from the new folder path. GOPATH remains unchanged.
Steps to recreate:
The text was updated successfully, but these errors were encountered: