carvel-dev / carvel-dev/ytt

confusing error message when overlay/match expects is not quoted

Open
#347 1 comment 0 reactions 0 assignees View on GitHub
discussion error msg improvement
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

```yaml
---
id: 1
type: book
modified: false
---
id: 2
type: book
modified: false
---
id: 3
type: course
modified: false
```

```yaml
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.all, expects=1+
---
modified: true
```

Gives you the error message
```yaml
- got ')', want primary expression
match-subset-docs.yml:2 | #@overlay/match by=overlay.all, expects=1+
```

What's confusing is that there isn't a `)` in the annotation that I wrote.

I was hoping it would print an error saying my `expects` input should be quoted. Or ideally it accepts the `1+` as a valid token (ie. without the quoting)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the YAML and overlay annotation from the issue, then trace how the annotation parser handles the unquoted `expects=1+` value. Done means either accepting `1+` as a valid token or replacing the misleading `got ')', want primary expression` message with an error that explains the quoting requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.