Skip to content

Associative array is broken. Regression?  #1108

Closed

Description

@kundeng

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 

Activity

  1. mvdan commented on Feb 10, 2025

    @mvdan
    Owner

    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.

  2. added a commit that references this issue on Feb 10, 2025
    7f87c18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址