|
|
|
|
|
by yarcob
1705 days ago
|
|
If you would use that variable, you wouldn't set it globally. You would set it only for the syncthing process. For example, when you use systemd to run syncthing, you can configure the environment for syncthing in the unit file. Other Go programs on your machine won't be affected. |
|
I hark back to when environment variables were set globally on a machine (back in DOS days).
I realize NTVDM emulation introduced the ability to configure more granular ones (eg. system vs. user) and you can now create a shortcut[1] that launches an intermediate step which tailors the environment for a single process. But always viewed that as a cludgey convenience for users, not a design paradigm for developers. (Also with at least six[2] different places to check for where Windows envvars come from, I typically favor the expliciteness of command line switches).
What happens if someone's creating a script that will shell out simultaneously to multiple Go programs? Do they all inherit the parent's environment variables? Does the script now have to tailor the same-named variable for each one?
Am I doing something wrong or is this easier on Linux and us Windows schmucks got left behind?
Thanks for any elucidation...
[1] https://stackoverflow.com/questions/3036325/can-i-set-an-env...
[2] https://flylib.com/books/en/4.53.1.59/1/#:~:text=Environment...