cue
cue copied to clipboard
cue: ParsePath does not accept index as first element of path
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