Set environment variable in visual code

i need to setup environment variable in visual code IDE for the project.
i try in the launch.json like that:

“configurations”: [
{
“name”: “Launch”,
“type”: “go”,
“request”: “launch”,
“mode”: “auto”,
“program”: “${fileDirname}”,
“env”: {“GCP_PROJECT”:“example” },
“args”: []
}
]

but in os.Getenv(“GCP_PROJECT”) it return empty string.

please help!

2 Likes

If you want to set environment variable in VSCode embedded terminal, try this:

http://serkanh.github.io/vscode,terminal,/2018/10/15/set-up-vscode-terminal-env-var.html

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.