I want to globally set the environment variable from my golang code which can be accessed by anything on my OS. For now I have 2 options neither of them fits my situation
use os.Setenv(key, value) - This only sets the variable in the context of code, once the code ends, I see the variable’s old value
use penv package (source: https://github.com/badgerodon/penv) - This doesn’t work for some operating systems like OpenBSD (unix-like OS) because it uses https://github.com/mitchellh/go-ps/ API to get the processes and it does not have openBSD and netBSD support however freeBSD works
Also even windows does not change the environment of already started children after changing the own environment, you always need to trigger a refresh in the child.
So you need to find another way for IPC. The Environment variables are not suitable for that.