-
Notifications
You must be signed in to change notification settings - Fork 752
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
Optional configuration paths for gopls, go-outline, godef & C. #2874
Comments
Have you looked into the You can even specify the full path of the Let us know if this doesn't work for you. Lastly, |
Waw, I completely missed that config, thanks so much @hyangah ! Now I have something like: {
"go.alternateTools": {
"go": "${workspaceRoot}/.devenv/profile/bin/go",
"gomodifytags": "${workspaceRoot}/.devenv/profile/bin/gomodifytags",
"godef": "${workspaceRoot}/.devenv/profile/bin/godef",
"gofmt": "${workspaceRoot}/.devenv/profile/bin/gofmt",
"goimports": "${workspaceRoot}/.devenv/profile/bin/goimports",
"gopls": "${workspaceRoot}/.devenv/profile/bin/gopls",
"godoc": "${workspaceRoot}/.devenv/profile/bin/godoc",
"gotests": "${workspaceRoot}/.devenv/profile/bin/gotests",
"godex": "${workspaceRoot}/.devenv/profile/bin/godex",
"dlv": "${workspaceRoot}/.devenv/profile/bin/dlv"
},
"go.formatTool": "gofmt",
"editor.formatOnSave": true
} And it works! Is there any room for additional optimization? Essentially all the binaries are in the same folder ( Thanks |
Good to know that that works. As I mentioned earlier, |
Is your feature request related to a problem? Please describe.
Using devenv in conjunction with nix makes it hard to have a "portable" and "reproducible" development environment with go & vscode-go.
devenv, when activated, will install golang and other system packages in a subshell. Env variables are updated in the sub-shell, but are not readable by VS Code.
Example of my
devenv.nix
file:With the current version of the plugin I can manually set the
go.gopath
:It points to a sandboxed folder of the golang interpreter, but that folder only contains the standard go binaries.
Indeed
godef
,gopls
andgo-outline
are installed in different sendboxed folders (because this is what Nix does and what makes Nix a fully reproducible package manager):Describe the solution you'd like
The easier solution is to replicate what the Python plugin does.
In Python the end user can configure the full path (or just the name) of a command, as you can see in this screenshot:
This is a common problem in Python, especially when you need to run your code in a virtual environment (
python3 -m venv .venv
).By following this approach, the go plugin should be updated by exposing a configuration entry for every optional package, allowing the user to set its full path if needed (or by using as a fallback the actual value).
This will not be a breaking change but will unlock advanced usage.
The text was updated successfully, but these errors were encountered: