Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associative array is broken. Regression? #1108

Closed
kundeng opened this issue Nov 6, 2024 · 1 comment
Closed

Associative array is broken. Regression? #1108

kundeng opened this issue Nov 6, 2024 · 1 comment

Comments

@kundeng
Copy link

kundeng commented Nov 6, 2024

Is this regression of #884?

The error is filed with go-task go-task/task#1908 but was asked to report it here.

Using the latest go-task. The code below just prints "0".

version: '3'

tasks:
  test:
    desc: "This taskfile manages Docker stacks."
    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 
@mvdan
Copy link
Owner

mvdan commented Feb 10, 2025

Thanks for reporting this; indeed this appears to be broken. Declaring variables with a type, while leaving them unset, is a weird edge case that I hadn't properly worried about before.

@mvdan mvdan closed this as completed in 7f87c18 Feb 10, 2025
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

No branches or pull requests

2 participants