Skip to content

fix(fish): honor GO_TASK_PROGNAME for experiments cache#2730

Merged
vmaerten merged 2 commits intogo-task:mainfrom
SergioChan:fix-fish-completion-progname-2727
Mar 21, 2026
Merged

fix(fish): honor GO_TASK_PROGNAME for experiments cache#2730
vmaerten merged 2 commits intogo-task:mainfrom
SergioChan:fix-fish-completion-progname-2727

Conversation

@SergioChan
Copy link
Copy Markdown
Contributor

Summary

  • use $GO_TASK_PROGNAME instead of hardcoded task when refreshing fish completion experiment cache
  • fixes fish completion warnings on distros where the binary name is go-task
  • keeps completion behavior unchanged for default task installs

Testing

  • git diff --check
  • go test ./... (not runnable in this environment: required Go toolchain go1.25 is unavailable via GOTOOLCHAIN download)

Related

@trulede trulede added the area: completions Changes related to shell completions and scripts. label Mar 15, 2026
Copy link
Copy Markdown
Contributor

@trulede trulede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix seems OK.
I'm not familiar with fish and can't verify.

@appenzellergeller
Copy link
Copy Markdown

I did face the same issue today and have already tried the fix as it is proposed in this PR.
This will unfortunately not work in any case.

The are situations where the __go_task_is_experiment_enabled is called from another script and then the variable $GO_TASK_PROGNAME has not been defined in that scope.

If you add the --inherit-variable GO_TASK_PROGNAME to the function then it will work. See below.

function __go_task_get_experiments --inherit-variable GO_TASK_PROGNAME
[...]
    # Refresh cache
    set -g __go_task_experiments_cache ($GO_TASK_PROGNAME --experiments 2>/dev/null)
[...]
end

Copy link
Copy Markdown
Contributor

@trulede trulede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you check if the suggested changes are viable/working:

function __go_task_get_experiments --inherit-variable GO_TASK_PROGNAME
[...]
    # Refresh cache
    set -g __go_task_experiments_cache ($GO_TASK_PROGNAME --experiments 2>/dev/null)
[...]
end

@vmaerten vmaerten self-requested a review March 18, 2026 20:44
@SergioChan
Copy link
Copy Markdown
Contributor Author

Thanks for the repro details and suggestion — I pushed an update to this PR.

What changed

  • Added --inherit-variable GO_TASK_PROGNAME to __task_get_experiments in completion/fish/task.fish.
  • This ensures the helper keeps access to GO_TASK_PROGNAME when invoked through __task_is_experiment_enabled from other completion contexts.

Validation

  • Attempted: go test ./...
  • Result: could not run in this environment because the required Go 1.25 toolchain is unavailable.

If you want, I can also add --inherit-variable GO_TASK_PROGNAME to __task_is_experiment_enabled for extra explicitness, but this change should address the scope issue reported here.

@SergioChan
Copy link
Copy Markdown
Contributor Author

Thanks for the concrete fish-shell suggestion (--inherit-variable GO_TASK_PROGNAME) and for testing this path.

I’ll incorporate that approach and push an update.

Copy link
Copy Markdown
Member

@vmaerten vmaerten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@vmaerten vmaerten merged commit 87b12e6 into go-task:main Mar 21, 2026
14 checks passed
vmaerten added a commit that referenced this pull request Mar 21, 2026
Copilot AI pushed a commit to libor-m/task that referenced this pull request Mar 27, 2026
Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>
Copilot AI pushed a commit to libor-m/task that referenced this pull request Mar 27, 2026
Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: completions Changes related to shell completions and scripts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task completion with the fish shell raise a warning when distro use the go-task name instead of task

4 participants