...

Text file src/cuelang.org/go/doc/tutorial/basics/4_references/85_cycleref.txtar

Documentation: cuelang.org/go/doc/tutorial/basics/4_references

     1exec cue eval cycleref.cue
     2cmp stdout expect-stdout-cue
     3
     4-- frontmatter.toml --
     5title = "Cycles in Fields"
     6description = ""
     7
     8-- text.md --
     9Also, we know that unifying a field with itself will result in the same value.
    10Thus if we have a cycle between some fields, all we need to do is ignore
    11the cycle and unify their values once to achieve the same result as
    12merging them ad infinitum.
    13
    14-- cycleref.cue --
    15labels: selectors
    16labels: {app: "foo"}
    17
    18selectors: labels
    19selectors: {name: "bar"}
    20
    21-- expect-stdout-cue --
    22labels: {
    23    app:  "foo"
    24    name: "bar"
    25}
    26selectors: {
    27    name: "bar"
    28    app:  "foo"
    29}

View as plain text