Closed panzi closed 1 week ago
This code is inherited from https://github.com/joho/godotenv/blob/main/parser.go, there's no strong design decision from the compose-spec maintainers in this code.
Such "tail recursion" - AFAIK go compiler does not offer any sort of tail-Call optimization, which would magically detect and convert this into a loop - is generaly preferred to preserve readability vs nested loop (this is a short function, so not so obvious here)
Hey, I just noticed that the recursion here could be a simple loop, I think? (I'm new to Go, not new to programming.)
https://github.com/compose-spec/compose-go/blob/35c575c758afd2a8363bd47290c3ddec0d23ebaf/dotenv/parser.go#L77-L94
Could be something like this:
This is not a bug, just something I noticed while reading the source in order to understand exactly what syntax this tool is accepting. :smile: Sorry for the noise.