Skip to content

Task is doing something weird with escaping... #712

@ghostsquad

Description

@ghostsquad
  • Task version: 3.12.0
  • Operating System: OSX

As related to #179

Example Taskfile showing the issue

version: '3'

tasks:
  one:
    vars:
      FOO: '{{.FOO}}'
    cmds:
    - echo '{{.FOO}}'

  two:
    cmds:
    - task: one
      vars:
        FOO: '{{`${{should be escaped}}`}}'
at 18:03:01 ❯ t --taskfile Taskfile.test.yml --dry two
task: Failed to run task "two": template: :1: function "should" not defined

The more upvoted answer in stackoverflow indicates that this should work:

{{`{{Your.Angular.Data}}`}}

As should the following which is syntax needed for templating github actions workflow yaml file.

{{`${{Your.Angular.Data}}`}}

Gomplate (A CLI tool for go template) handles this just fine:

at 18:09:37 ❯ gomplate --in '{{`${{should be escaped}}`}}'

${{should be escaped}}%

**Note that the trailing % is the shell's way of telling you there's no trailing newline character at the end of this output.

Also reproducible on go playground: https://go.dev/play/p/JkgDIrUs3RQ

It's almost as if the task is double evaluating things?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions