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

Add go.goos to the extension options #632

Closed
hickeng opened this issue Nov 19, 2016 · 7 comments

Comments

@hickeng
Copy link

@hickeng hickeng commented Nov 19, 2016

Currently the only way I've found to set GOOS for the Go tools in vscode is to set the environment before launching the editor - this doesn't work well if you have multiple workspaces that may need different GOOS settings.

While I appreciate the prompt to ensure that the code at least compiles on multiple platforms, not all 3rd party packages do so and that causes real issues with guru and the other navigation tools.

@ramya-rao-a

This comment has been minimized.

Copy link
Member

@ramya-rao-a ramya-rao-a commented Jan 13, 2017

@hickeng On the same line, wouldn't you also need GOARCH?
@mattetti You have any thoughts here?

@mattetti

This comment has been minimized.

Copy link
Contributor

@mattetti mattetti commented Jan 16, 2017

It is a bit of an edge case but I agree that it would be a useful feature to have. @hickeng can you explain a bit more your edge case, are you trying to check that your code compiles properly against multiple os/arch targets?

@hickeng

This comment has been minimized.

Copy link
Author

@hickeng hickeng commented Jan 17, 2017

@ramya-rao-a For completeness yes, but it's GOOS that's the most awkward currently.

@mattetti The multi-target case is definitely one that I hit, but it's not actually the one I experience on a daily basis.
I'm using Windows for my OS for various reasons but core portions of code I'm developing build only on Linux. It's easy enough to build that portion of the code in a VM or cross-compile but the Go tools are not happy in vscode. For example godefs cannot find call targets in the Linux only code. I have tried setting GOOS to linux in the past but never had it propagate to the tools unless I set it at a system level which causes other issues. I realize that I'd have issue navigating the Windows portions of the code if I change GOOS at a workspace level but the portions of the code that are not multi-platform are Linux so that's where the pain primarily presents.

@ramya-rao-a

This comment has been minimized.

Copy link
Member

@ramya-rao-a ramya-rao-a commented Jan 18, 2017

Thanks @hickeng. This should be easy to do.

PRs are welcome if anyone wants to take a crack at this.

Hints:

  • Add a new configuration property in package.json
  • Update updateGoPathGoRootFromConfig which updates GOPATH and GOROOT from settings to include updating the GOOS as well. Probably rename the method as well :)
@ramya-rao-a

This comment has been minimized.

Copy link
Member

@ramya-rao-a ramya-rao-a commented May 2, 2017

This is fixed by #932.

The update containing the fix will be out soon

@ramya-rao-a ramya-rao-a closed this May 2, 2017
@ramya-rao-a

This comment has been minimized.

Copy link
Member

@ramya-rao-a ramya-rao-a commented May 4, 2017

Fix is out in the latest update (0.6.60)

@hickeng Can you add your env vars in the new setting go.toolsEnvVars and confirm if your issue is fixed?

@jackie-qiu

This comment has been minimized.

Copy link

@jackie-qiu jackie-qiu commented May 31, 2017

@ramya-rao-a Thank you, "go.toolsEnvVars": {"GOOS" : "linux"}, that works for me.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.