.env.go.local
This is safer because you control when overrides apply.
func Load() // Load default .env first (if it exists) if err := godotenv.Load(".env"); err != nil log.Println("No .env file found, using system envs") .env.go.local
import "://github.com" func updateEnv(key, value string) // Load existing vars from the local file env, _ := godotenv.Read(".env.go.local") // Update or add the new value env[key] = value // Write the entire map back to the file godotenv.Write(env, ".env.go.local") Use code with caution. Copied to clipboard Key Considerations This is safer because you control when overrides apply