Giter VIP home page Giter VIP logo

Comments (5)

eadlam avatar eadlam commented on June 26, 2024

This snippet appears verbatim in the spec and results in the same error:

a: {
    foo:    string  // foo is a string
    ["^i"]: int     // all other fields starting with i are integers
    ["^b"]: bool    // all other fields starting with b are booleans
    ...string       // all other fields must be a string
}

from cue.

eadlam avatar eadlam commented on June 26, 2024

I tried going back a few versions:

$ go get cuelang.org/go/cmd/[email protected]
go: downloading cuelang.org/go v0.4.0-beta.2
$ cue eval ./test.cue
missing ',' in struct literal:
    ./test.cue:5:8
expected '}', found 'EOF':
    ./test.cue:6:3
$ go get cuelang.org/go/cmd/[email protected]
go: downloading cuelang.org/go v0.4.0-beta.1
$ cue eval ./test.cue
a: conflicting values string and {foo:string,["^i"]:int,["^b"]:bool,...,string} (mismatched types string and struct):
    ./test.cue:1:4
    ./test.cue:5:8
$ go get cuelang.org/go/cmd/[email protected]
go: downloading cuelang.org/go v0.4.0-alpha.2
$ cue eval ./test.cue
combining bulk optional fields with other fields deprecated as of v0.2.1: try running `cue fix` using CUE v0.2.2 on the file or module to upgrade:
    ./test.cue:6:1

It looks like this syntax is deprecated. I also tried cue fix with a few different versions (including v0.2.2) but nothing actually fixed it.

from cue.

lytedev avatar lytedev commented on June 26, 2024

FWIW, I achieved this with the following:

type: {
	field1: int
	[string]: ...string
}

from cue.

eadlam avatar eadlam commented on June 26, 2024

@lytedev, what version are you on? This fails for me on v0.4.0:

$ cue version
cue version v0.4.0 linux/amd64
$ cat test.cue 
type: {
        field1: int
        [string]: ...string
}
$ cue eval test.cue 
expected operand, found '...':
    ./test.cue:3:12
expected '}', found 'EOF':
    ./test.cue:4:2

from cue.

cueckoo avatar cueckoo commented on June 26, 2024

This issue has been migrated to cue-lang/cue#1065.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

from cue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.