goenvloader lets you load your project specific environment variables using just a method call.
- Initialize a go module.
go mod init example.com/package
- Install goenvloader
go get github.com/ajsqr/goenvloader
DATABASE=POSTGRES
PASSWORD=PASSWORD #This is a comment
package main
import "github.com/ajsqr/goenvloader"
func main(){
loader := goenvloader.NewLoader(".env") // The env file name
loader.Load()
}