internal/cuegen incompatible with cuelang.org/go v0.16.0
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Read internal/cuegen/cue.go, especially doScalarField(), and compare its ast.Field construction with the cuelang.org/go v0.16.0 API. Reproduce the issue with go build ./... or golangci-lint using CUE v0.16.0; done means the project compiles without the unknown Optional field error.
Written by the indexing model from the issue text.
Description
Overview
The internal/cuegen/cue.go file uses ast.Field.Optional (a token.Pos), which was removed in cuelang.org/go v0.16.0. The field was replaced with ast.Field.Constraint (a token.Token), where token.OPTION represents an optional field.
This causes a compilation error when a downstream project's dependency graph pulls in CUE v0.16.0:
vendor/github.com/redpanda-data/benthos/v4/internal/cuegen/cue.go:171:3:
unknown field Optional in struct literal of type ast.Field
Affected Code
The affected code is in doScalarField():
return &ast.Field{
Label: label,
Value: val,
Optional: optional, // no longer exists in cuelang.org/go v0.16.0
}, nil
The new CUE API equivalent would be:
return &ast.Field{
Label: label,
Value: val,
Constraint: token.OPTION, // when the field should be optional
}, nil
Reproduction
- In a Go project that depends on
benthos/v4, updatecuelang.org/goto v0.16.0 - Run
go build ./...(orgolangci-lint) - Compilation fails with the error above
Versions
- cuelang.org/go v0.16.0 (breaking change)
- benthos v4.68.0 (latest, still pins CUE v0.15.4)
- Dominant language
- Go
- Stars
- 571
- Forks
- 121
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 18
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from redpanda-data/benthos
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
redpanda-data/benthos#503 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
redpanda-data/benthos#502 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 72/100
redpanda-data/benthos#481 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
redpanda-data/benthos#469 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
redpanda-data/benthos#441 · 1 comment ·
All issues in redpanda-data/benthos
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·