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
I am looking forward to your input
Thanks in advance!