I\'m trying to set some environment variables on my machine using Go OS
err := os.Setenv(\"DBHOST\", dbHostLocal)
if err != nil {
log.Fatalf(
Short: It is not possible. You can't change the environment of your parent process. You can only change your own and pass it to your children.
What you should do is maintain a config file. There are plenty of go config libs out there: ini, yaml, etc.
If your program changes the config, save it to disk after each change or one in a while or when the process exits.