task
task copied to clipboard
Empty required variable still passing the required check?
Discussed in https://github.com/go-task/task/discussions/1620
Originally posted by usersina April 26, 2024
- Task version:
v3.36.0
- Operating system:
Arch Linux x86_64 6.6.28-1-lts
- Experiments enabled:
No
Given the following Taskfile.yml
:
version: "3"
silent: true
vars:
IMAGE_NAME: my-web-app
CONTAINER_REGISTRY: # docker.io
tasks:
check-missing:
desc: Test the task variables
requires:
vars: [CONTAINER_REGISTRY]
cmds:
- echo "CONTAINER_REGISTRY is {{.CONTAINER_REGISTRY}}"
My check-missing
is not working as intended.
Actual output
CONTAINER_REGISTRY is
Expected output
task: Task "check-missing" cancelled because it is missing required variables: CONTAINER_REGISTRY
This works as intended if I simply delete CONTAINER_REGISTRY
or comment it out, but why isn't it working if it's empty?