Skip to content

Conversation

@majiayu000
Copy link

Summary

This PR fixes #1847

Changes

  • taskfile/dotenv.go
  • taskfile/dotenv_test.go
  • variables.go

Fixed non-deterministic iteration order when processing dotenv files by
introducing ReadDotenvOrdered which reads key-value pairs in the order
they appear in the file. This prevents race conditions when variables
reference each other with template syntax like {{.VAR}}.

The issue occurred because godotenv.Read() returns a map[string]string,
and Go map iteration order is non-deterministic. This caused inconsistent
variable expansion when nested variables depended on the order of
processing.

Signed-off-by: majiayu000 <1835304752@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent Variable Expansion When Using {{.VAR}} in .env Files with Nested Variables

1 participant