Open jpluscplusm opened 8 months ago
Slack thread: https://cuelang.slack.com/archives/C012UU8B72M/p1709805267382589?thread_ts=1706266602.453679&cid=C012UU8B72M
Question:
I define the field labels as this labels: [string]: string Can I get the literal [string]: string somehow?
labels
labels: [string]: string
[string]: string
Solution:
go mod tidy go run . cmp stdout stdout.golden -- go.mod -- module mod.example go 1.22.1 require cuelang.org/go v0.7.1 -- main.go -- package main import ( "fmt" "cuelang.org/go/cue" "cuelang.org/go/cue/cuecontext" ) const source = ` labels: {[ string]: string} ` func main() { ctx := cuecontext.New() v := ctx.CompileString(source) labels := v.LookupPath(cue.ParsePath("labels")) fmt.Printf("%#v\n", labels) } -- stdout.golden -- [string]: string
Slack thread: https://cuelang.slack.com/archives/C012UU8B72M/p1709805267382589?thread_ts=1706266602.453679&cid=C012UU8B72M
Question:
Solution: