Skip to content

Late interpolation #2828

@KalleDK

Description

@KalleDK

Description

When using a variable with another inside, I would expect it to be interpolated at use time.
I don't know if I'm doing something wrong

version: '3'

vars:
  A: "a"
  B: "b"
  AB: "{{ .A }}{{ .B }}"

tasks:
  default:
    vars:
      A: "aa"
    cmds:
      - echo "{{ .AB }}"

I would expect it to output aab not ab (even with A: '{{ default "a" .A }}' ) is it not working

The whole problem arises from me setting a BUILD_DIR as a var and calculate that based on other variables.. Now if I include this taskfile and change some of the variables that are used in the BUILD_DIR, then these are updated, but BUILD_DIR stays default

Version

3.50.0

Operating system

Win 11 / Linux

Experiments Enabled

No response

Example Taskfile

version: '3'

vars:
  A: "a"
  B: "b"
  AB: "{{ .A }}{{ .B }}"

tasks:
  default:
    vars:
      A: "aa"
    cmds:
      - echo "{{ .AB }}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for support.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions