splunk / qbec

configure kubernetes objects on multiple clusters using jsonnet
https://qbec.io
Apache License 2.0
172 stars 37 forks source link

qbec fmt panics on malformed jsonnet string #284

Open harsimranmaan opened 2 years ago

harsimranmaan commented 2 years ago
echo "{a : '^/v1/abc-[\w-.]+/xyz/[\w-.]+$'}" > a.jsonnet
qbec fmt a.jsonnet
qbec fmt  a.jsonnet
panic: Badly formatted string, should have been caught in lexer.

goroutine 1 [running]:
github.com/google/go-jsonnet/internal/formatter.(*EnforceStringStyle).LiteralString(0xc0001d38f0, {0x265b158, 0xc0001d38f0}, 0xc0001df080, {0x0, 0x0})
    /home/runner/go/pkg/mod/github.com/google/go-jsonnet@v0.18.0/internal/formatter/enforce_string_style.go:45 +0x17b
github.com/google/go-jsonnet/internal/pass.(*Base).Visit(0xc000138190, {0x265b158, 0xc0001d38f0}, 0xc000138170, {0x0, 0x0})
    /home/runner/go/pkg/mod/github.com/google/go-jsonnet@v0.18.0/internal/pass/pass.go:433 +0x24c
github.com/google/go-jsonnet/internal/pass.(*Base).ObjectField(0xc0001380f0, {0x265b158, 0xc0001d38f0}, 0xc0001380f0, {0x0, 0x0})
    /home/runner/go/pkg/mod/github.com/google/go-jsonnet@v0.18.0/internal/pass/pass.go:162 +0xdd

Expected graceful failure. Might need patching jsonnet upstream or panic recovery in formatter