joho/godotenv ? reverse-engineered prompt
Reverse engineered prompt
Build me a small Go library and command line tool that helps apps load environment variables from a .env file.
I want it to work like the usual dotenv tools, so a Go app can call something like load the file into the process environment, or read it into a map if I only want the values without changing anything. It should handle simple key value lines, comments, export style lines, quoted values, and a YAML like format too. It should also let me load from a file path, from a reader, or from a string, and be able to write the data back out in the right format.
Please include a tiny autoload option that reads .env on import, and a command that can run another program after loading env values, with an option to override existing variables if needed. Make the tests solid, especially around parsing edge cases and matching common dotenv behavior. If you need to check current Go docs or best practices, look them up online.
Are you gonna build this?
make sure you review the code using coderabbit