package can access system environment variables, it does not natively load files. To use .env.local , you typically use a third-party library like 1. Create your .env.local In your project's root directory, create a file named .env.local and add your variables in # .env.local
# Other local settings RUN_MODE=local
// Load returns the configuration. Local file will augment this. func Load() AppConfig return AppConfig Port: getEnvAsInt("PORT", 8080), Debug: getEnvAsBool("DEBUG", false), DBURL: os.Getenv("DATABASE_URL"), .env.go.local
Want explicit control? Write a small merge function: package can access system environment variables, it does