Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

cue: ParsePath does not accept index as first element of path #3467

Open
rogpeppe opened this issue Sep 27, 2024 · 0 comments
Open

cue: ParsePath does not accept index as first element of path #3467

rogpeppe opened this issue Sep 27, 2024 · 0 comments
Labels

Comments

@rogpeppe
Copy link
Member

What version of CUE are you using (cue version)?

$ cue version
v0.10.0

Does this issue reproduce with the latest stable release?

Yes

What did you do?

exec go mod tidy
exec go run .
-- go.mod --
module test

require cuelang.org/go v0.10.0

-- main.go --
package main

import (
	"log"

	"cuelang.org/go/cue"
)

func main() {
	p := cue.MakePath(cue.Index(2))
	if err := p.Err(); err != nil {
		log.Fatal(err)
	}
	q := cue.ParsePath(p.String())
	if err := q.Err(); err != nil {
		log.Fatalf("cannot round-trip path %q: %v", p.String(), err)
	}
}

What did you expect to see?

A passing test: an index is a perfectly valid thing to have as the first element of a path.

What did you see instead?

> exec go mod tidy
> exec go run .
[stderr]
main.go:16: cannot round-trip path "[2]": invalid label [2] 
exit status 1
[exit status 1]
FAIL: /tmp/y.txtar:2: unexpected command failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant