Skip to content

fix(env): resolve nested dotenv template expansion deterministically#2726

Open
SergioChan wants to merge 1 commit intogo-task:mainfrom
SergioChan:fix-dotenv-template-1847
Open

fix(env): resolve nested dotenv template expansion deterministically#2726
SergioChan wants to merge 1 commit intogo-task:mainfrom
SergioChan:fix-dotenv-template-1847

Conversation

@SergioChan
Copy link

@SergioChan SergioChan commented Mar 8, 2026

Summary

  • resolve dotenv values with iterative template expansion so nested {{.VAR}} chains are evaluated consistently
  • keep dotenv precedence behavior unchanged (first file wins), while making resolution order deterministic
  • add a regression test for nested dotenv template chains (MID_DIR -> FINAL_DIR -> FULL_PATH)

Testing

  • Not run locally: this environment has Go 1.22.2 and cannot download the required Go 1.25 toolchain (go.mod requires go >= 1.25)
  • Added targeted regression test: TestResolveDotenvVarsNestedTemplates in variables_dotenv_test.go

Related

Fixes #1847

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