go-task / task

A task runner / simpler Make alternative written in Go
https://taskfile.dev
MIT License
11.01k stars 584 forks source link

Associative arrays do not work in properly #785

Closed everactivetim closed 2 years ago

everactivetim commented 2 years ago

I believe this is the result of this issue I filed with sh: https://github.com/mvdan/sh/issues/884

Example Taskfile showing the issue

version: '3'

tasks:
  default:
    cmds:
      - |
        declare -A database_lookup
        database_lookup["management"]=management
        database_lookup["devicetwin"]=devicetwin
        database_lookup["identity"]=identity

        for d in "${!database_lookup[@]}"
        do
          echo $d
        done
everactivetim commented 2 years ago

Output of Taskfile:

0

Output from same as shell script:

identity
devicetwin
management
ghostsquad commented 2 years ago

May want to file this with https://github.com/mvdan/sh

everactivetim commented 2 years ago

I did. I thought you/users might want a tracking issue here until that is resolved since Taskfiles are broken for this use case until then. If not, ok.

andreynering commented 2 years ago

Hi @everactivetim,

Thanks for taking the initiative of opening the issue upstream (I usually have to do it myself).

I'll close this since it has been fixed at https://github.com/mvdan/sh/pull/893 and I just upgraded the library here as well.

everactivetim commented 2 years ago

@andreynering - Thanks to you for responding so quickly to the upstream fix. Happy to do my small part!