golang set env var
package main
import (
"fmt"
"os"
)
func main() {
// Step 1: Set environment variable key and value
envKey := "MY_ENV_VARIABLE"
envValue := "my_env_value"
// Step 2: Set environment variable using os.Setenv()
os.Setenv(envKey, envValue)
// Step 3: Retrieve and print the set environment variable
retrievedValue := os.Getenv(envKey)
fmt.Printf("Value of %s: %s\n", envKey, retrievedValue)
}