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

direnv support #453

Closed
AlekSi opened this issue Aug 1, 2020 · 4 comments
Closed

direnv support #453

AlekSi opened this issue Aug 1, 2020 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@AlekSi
Copy link
Contributor

AlekSi commented Aug 1, 2020

https://direnv.net is a popular tool for setting per-directory or per-project environment variables. Currently, the Go plugin is not compatible with it. More specifically, there is no way to use .envrc-exported environment variables in Go tests:

  • the is no way to run go test helper in the full shell environment;
  • Test Env File setting expects key=value format, while .envrc requires one to use export key=value.
@hyangah
Copy link
Contributor

hyangah commented Aug 3, 2020

@AlekSi I think this is beyond the scope of this extension's function. This extension inherits all the environment variables from the vscode. So, make sure the vscode understands the direnv per-project environment settings - i.e. launch vscode from the terminal that recognizes and processes direnv settings. If vscode fails to handle that as you hoped, please file an issue in github.com/microsoft/vscode.

@AlekSi
Copy link
Contributor Author

AlekSi commented Aug 3, 2020

I think this is beyond the scope of this extension's function.

I wonder why those settings are in scope then:

image

So, make sure the vscode understands the direnv per-project environment settings - i.e. launch vscode from the terminal that recognizes and processes direnv settings.

I always do that, but I also never saw VSCode inherit environment variables from the shell. And to be honest, I would consider that behavior to be a bug.

What can solve this ticket relatively easier is an ability to start go test in a shell environment.

@hyangah
Copy link
Contributor

hyangah commented Aug 3, 2020

@AlekSi The Test Env File assumes .env file format (KEY=VALUE). My understanding is that .envrc is more flexible than .env and may contain not only export but unsetting, etc. Please see direnv/direnv#284

If VS Code fails to inherit environment variables from the shell, that's a bug of VS Code.

@hyangah hyangah added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 7, 2020
@gopherbot
Copy link
Collaborator

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants