-
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
Launch.json envFile Won't Override Dev Container Env #452
Comments
@stnguyen90 thanks for the bug report. The debug adapter constructs the environment variables by merging
@Chuxel can you help us understand why devcontainer has to add these extra envs again in the launch args and what's the best practice in handling env variables? Thanks! |
Could this be what's setting the launchArgs.env to the container environment? I tried to find where Delve was initialized to try and see how launchArgs was initialized but this was the best I could find. |
@stnguyen90 You are right - i forgot we mutate launchargs env vars there too. Not sure why it needs to mutate the launch env arg. If it is necessary it needs to process the launch args as the debug adapter does. :-( |
Variables set using |
I think only |
Any environment file in devcontainer.json only applies for when the container is first spun up. The launch configs I'm referring to are important for overriding environment variables for any particular launch/debug session after the dev container has already started. |
Since |
Tested:
So, yes, you are correct. Remote Containers are just a red herring. The OS env vars overrides envFile with and without remote containers. I still think this might be the problem: vscode-go/src/goDebugConfiguration.ts Lines 65 to 70 in 38b056d
|
Would it be okay to remove |
Change https://golang.org/cl/248659 mentions this issue: |
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gocode -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env
to get the go development environment detailsShare the Go related settings you have added/edited
Describe the bug
Specifying an envFile in a launch config doesn't seem to work.
Steps to reproduce the behavior:
Testing: devcontainer
Testing: devcontainer
Expected output is
Testing: env file
Overriding using
env
rather thanenvFile
seems to work.Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: