Skip to content
New issue

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

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

Already on GitHub? # to your account

The ne, lt, le, gt, and ge comparison operators should fail given a single argument #9462

Closed
jmooring opened this issue Feb 3, 2022 · 1 comment · Fixed by #9467
Closed

Comments

@jmooring
Copy link
Member

jmooring commented Feb 3, 2022

Prior to 0c251be (#6775) ...

{{ if eq 42 }} foo {{ end }} --> error calling eq: missing arguments for comparison
{{ if ne 42 }} foo {{ end }} --> wrong number of args for ne: want 2 got 1
{{ if gt 42 }} foo {{ end }} --> wrong number of args for gt: want 2 got 1
{{ if ge 42 }} foo {{ end }} --> wrong number of args for ge: want 2 got 1
{{ if lt 42 }} foo {{ end }} --> wrong number of args for lt: want 2 got 1
{{ if le 42 }} foo {{ end }} --> wrong number of args for le: want 2 got 1

Currently:

{{ if eq 42 }} foo {{ end }} --> error calling eq: missing arguments for comparison 
{{ if ne 42 }} foo {{ end }} --> foo
{{ if gt 42 }} foo {{ end }} --> foo
{{ if ge 42 }} foo {{ end }} --> foo
{{ if lt 42 }} foo {{ end }} --> foo
{{ if le 42 }} foo {{ end }} --> foo

Fixing this will break some already broken things in the wild. What brought this to my attention was someone doing ne .IsHome instead of not .IsHome.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants